In the our first example in first Quick Start page, we wrote the “Hello World” clause on the title bar. Now, let’s put it on the form.
Build a new project with “HelloWorld2” name, copy HelloWord.prg to HelloWorld2.prg and change it as below:
DEFINE WINDOW frmHWLabel ;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 200 ;
TITLE 'Hello World-2' ;
DEFINE LABEL lblHello
VALUE "Hello World !"
ACTIVATE WINDOW frmHWLabel
RETURN // Main()
DEFINE LABEL and END LABEL statements are for “Label” definition structure for the a window ( in this example Windows named as “frmHWLabel ” ). Label itself must have a name (“lblHello” in this example), and this name must be unique, such as a variable name. Beginning these names with a descriptive prefix ( “lbl” in the example) is a good programming practice.
Between DEFINE – END statements there are main properties of this label. Row, col numbers ( in pixels of course),value (for labels, value is a string constant to write in the your form/window) and font properties (NAME and SIZE)
Almost every GUI control definitions HMG have two syntax : With DEFINE and END structure and with @ command.Thus in the above example instead of DEFINE LABEL and END LABEL structure, you can use alternate @ syntax :
@ 75, 125 LABEL lblHello ;
VALUE "Hello World !" ;
FONT "Lucida" ;
A last note for this example : place
CENTER WINDOW frmHWLabel
statement END WINDOW statement and notice that how much HMG is powerful.