Professional Documents
Culture Documents
Tutorial
This Tutorial:
Rev. [1] - May 5, 2013
Rev. [136] - May 27, 2013
Index
Window
Icon
DatePicker
MonthCalendar
Label
Messages
Button
Image
StatusBar
Tab
Timer
Menu
1
Grid
Inputbox
Getcolor
ProgressBar
Slider
Spinner
ComboBox
Getfont
RadioGroup
TextBox
EditBox
Drawing
ToolBar
CheckBox
TimePicker
Resources
ActiveX
Ole
Sample Applications
Appendix A - Photos
Appendix B - Contributors
Appendix C - What users think
Appendix D - Communities
2
Record of Revision
Revision Date
1 May 5, 2013
Introduction
This tutorial is a brief, continuously updated, of the use of HMG. It is specifically written for
beginners that initially encountered some difficulties in using classes, however, extremely
powerful and efficient. The approach of the tutorial is different from other guides that are
online. It simply focuses a single class or single object, so you do not get lost in the maze
of the vast files of examples provided with the product. This will easily learn to manage
and plan their individual class, as needed, and, finally, to put "together" the whole.
Giovanni Di Maria
Legal Notices
This tutorial is a free document and will remain free. You can view, use, print and
redistribute it and/or modify it, without any limitations.
WINDOW - Window
The following example shows how to create a simple main window. The window is
resizable.
3
#INCLUDE "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
4
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
5
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
6
FUNCTION Blink()
IF Form_1.title == "Finestra di Giovanni"
Form_1.title := ""
ELSE
Form_1.title := "Finestra di Giovanni"
ENDIF
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
7
WINDOW - Retrieve version of Harbour and GCC
The following example shows how to retrieve informations from compilers used.
#include "hbver.ch"
#include "hmg.ch"
FUNCTION Main()
8
VALUE "Harbour version: " + cVersion1
Form_1.Activate
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
10
DATEPICKER - Editing a date
The following example shows how to enter and edit a date.
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
11
DATEPICKER - Editing a date and displaying the week day
The following example shows how to enter and edit a date. The program shows also the
week day of the date.
12
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
FUNCTION show_day()
Form_1.day.value := CDOW( Form_1.date.value )
RETURN NIL
13
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
14
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
15
LABEL - Text Label
The following example shows how to create a simple main window with a label, used as
text string.
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
16
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
17
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
LABEL - Alignment
The following example shows how to align a text in a Label.
18
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
19
LABEL - Rectangle
The following example shows how to create a green rectangle with a Label.
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
20
MSGBOX - Message Box (simple)
The following example shows how to create a simple window with an active button. If the
button is pressed, a message box appears.
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
21
MSGYESNO - Message Box (Yes and No buttons)
The following example shows how to create a simple window with the Yes and No button.
If the Yes button is pressed, the window title will change.
#include "hmg.ch"
FUNCTION Main()
22
TITLE "Finestra di Giovanni" ;
MAIN
END WINDOW
Form_1.Activate
RETURN NIL
FUNCTION Pressed()
LOCAL lResponse
lResponse := MsgYesNo( "Ok to change the Window Title ?" , "Information" )
IF lResponse
Form_1.title := "Title changed"
ENDIF
RETURN NIL
23
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
FUNCTION Pressed()
Form_1.width := 500
Form_1.height := 400
RETURN NIL
24
BUTTON - Button with icon
The following example shows how to create a simple button with a icon. If pressed, the
title bar changes.
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
25
FUNCTION Pressed()
Form_1.title := "Ok, changed"
RETURN NIL
26
#include "hmg.ch"
FUNCTION Main()
LOCAL cButton,k
for k := 1 TO 13
cButton := "button" + alltrim( str( k ) )
next k
Form_1.Activate
RETURN NIL
27
#include "hmg.ch"
FUNCTION Main()
LOCAL cButton,k
for k := 1 TO 13
cButton := "button" + alltrim( str( k ) )
next k
Form_1.Activate
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
29
@ 50, 50 BUTTON button ;
PARENT Form_1 ;
CAPTION "Press" ;
TOOLTIP "This is an help that explains the function of the button"
Form_1.Activate
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
30
Form_1.Activate
RETURN NIL
FUNCTION Pressed()
PLAY WAVE "cat.wav"
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
32
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
33
RETURN NIL
FUNCTION ShowTime()
Form_1.StatusBar.Item(1) := time()
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
34
TAB - TAB Control
The following example shows how to create three Tab.
#include "hmg.ch"
FUNCTION Main()
END TAB
Form_1.Activate
RETURN NIL
35
TIMER - Timer
The following example shows a clock every 1 second.
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
FUNCTION print_clock()
Form_1.Clock.value := time()
RETURN NIL
36
TIMER - Timer in the Window Title
The following example shows a clock on the Title bar of a window.
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
FUNCTION print_clock()
Form_1.title := time()
RETURN NIL
37
MENU - Menu
The following example shows the usage of menu. Every item can be connected to any
function or UDF.
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
FUNCTION none()
RETURN NIL
38
MENU - Menu with separators
The following example shows the usage of menu. An item can separated from the other
by a line separator. Every item can be connected to any function or UDF.
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
FUNCTION none()
RETURN NIL
39
QMenu - Menu and sub-menu
The following example shows the usage of menu and sub-menu. The sub-menu is also a
menu.
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
FUNCTION none()
RETURN NIL
40
GRID - Simple table
The following example shows how to create a small table, with 2 rows and 2 columns.
#include "hmg.ch"
FUNCTION Main()
41
ACTIVATE WINDOW Form_1
RETURN NIL
42
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
43
#include "hmg.ch"
FUNCTION Main()
USE prova
USE
RETURN NIL
44
INPUTBOX - Input Dialog window
The following example uses a input dialog window to insert values into the program.
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
FUNCTION Change()
Form_1.title := InputBox( "What's your name?" , "Title" )
RETURN NIL
45
GETCOLOR - Color Dialog
The following example shows how to use a color dialog to change the color of a text label.
46
47
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
FUNCTION color()
Form_1.testo.FONTCOLOR := GetColor()
RETURN NIL
48
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
FUNCTION go()
LOCAL k
FOR k:=1 TO 10000 STEP 0.1
Form_1.progresso.value := k
NEXT K
RETURN NIL
49
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
FUNCTION color()
Form_1.testo.FONTCOLOR :=
{Form_1.SliderRed.value,Form_1.SliderGreen.value,Form_1.SliderBlue.value}
RETURN NIL
51
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
FUNCTION go1()
Form_1.Slider2.value := Form_1.Slider1.value
RETURN NIL
52
FUNCTION go2()
Form_1.Slider1.value := Form_1.Slider2.value
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
FUNCTION go()
Form_1.testo.FontSize := Form_1.choose.value
RETURN NIL
COMBOBOX - ComboBox
The following example creates a combobox, with many items. User can select any item.
#include "hmg.ch"
FUNCTION Main()
54
PARENT Form_1 ;
ITEMS { "Italia","U.S.A.","Germania","Belgio","Spagna","Portogallo","Islanda" } ;
VALUE 1
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
FUNCTION update()
Form_1.testo.value := Form_1.nazioni.item(Form_1.nazioni.value)
RETURN NIL
56
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
FUNCTION font()
LOCAL aFont
aFont := GetFont()
Form_1.testo.fontname := aFont[1]
Form_1.testo.fontsize := aFont[2]
Form_1.testo.fontbold := aFont[3]
Form_1.testo.fontitalic := aFont[4]
RETURN NIL
57
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
FUNCTION message()
msgbox(Form_1.opzioni.caption(Form_1.opzioni.value))
RETURN NIL
58
TEXTBOX - Text box
The following example uses a textbox, to insert and view any data.
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
59
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
60
FUNCTION merge()
Form_1.sum.value := Form_1.name.value + Form_1.surname.value
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
FUNCTION cancella()
Form_1.F1.value := ""
Form_1.F2.value := ""
Form_1.F3.value := ""
Form_1.F4.value := ""
Form_1.F5.value := ""
Form_1.F6.value := ""
Form_1.F7.value := ""
Form_1.F8.value := ""
RETURN NIL
TEXTBOX - Password
The following example shows how to insert a password into a line edit. The asterisks will
be shown instead of the characters actually entered.
#include "hmg.ch"
FUNCTION Main()
@ 50,50 LABEL Lb ;
PARENT Form_1 ;
VALUE "Type a password"
@ 50,180 TEXTBOX pw ;
PARENT Form_1 ;
WIDTH 150 ;
HEIGHT 20 ;
PASSWORD
RETURN NIL
P#include "hmg.ch"
FUNCTION Main()
@ 50,50 LABEL Lb ;
63
PARENT Form_1 ;
VALUE "Only Six Numbers"
RETURN NIL
9 Displays digits
$ Displays a dollar sign in place of a leading space
* Displays an asterisk in place of a leading space
. Specifies a decimal point position
, Specifies a comma position
9 Digits
A Alphabetic Characters
! Converts an alphabetic character to uppercase
(All other characters ar included in text in the position indicated by the mask)
64
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
FUNCTION go()
Form_1.number.visible := .NOT. Form_1.number.visible
IF .NOT. Form_1.number.visible
Form_1.bottone.CAPTION := "Show Line Edit"
ELSE
Form_1.bottone.CAPTION := "Hide Line Edit"
END IF
RETURN NIL
65
EDITBOX - Edit box
The following example shows an editor and sets his text to bold, italic and size 20, color
blue.
#include "hmg.ch"
FUNCTION Main()
66
RETURN NIL
67
68
#include "hmg.ch"
#define CR Chr( 13 ) + Chr( 10 )
FUNCTION Main()
LOCAL cSt
cSt := ""
cSt := cSt + " .,.
" + CR
cSt := cSt + " .,;CCCCCCCC>-;;.
" + CR
cSt := cSt + " ;CCC>>''';;;<>;;,.`-;.
" + CR
cSt := cSt + " ,CC>' .;''CCCCCCCCCCC>;,.
" + CR
cSt := cSt + " ,cC> ,<CC>.''````''''''<CCC>.
" + CR
cSt := cSt + " .C'.;CCC>> ,cc$$$$$$$$$h.`'<>.;..
" + CR
cSt := cSt + " ; ;CCC> ,c$$$$$$$$$$$$$$$c -.`'CCC,
" + CR
cSt := cSt + " ',<CC>'.z$$$$$$$$$$$$$$$$$$h.`-;,cCC>
" + CR
cSt := cSt + " ,cCC> c$$$$$$$$$$$$$$$$$$$??$c <CCCCC> .,<>;CCC;>.
" + CR
cSt := cSt + " `CCC'.$$$$$$$$$$$$$$$$'',;:::$h <CC''< .;<CCC''>>''.,;;,.
" + CR
cSt := cSt + " ;CCC>.$$$$$$$$$$$$$$F =',;=-?$$h <CC; .;CCCCCC>' .;CCCCCCCC;
" + CR
cSt := cSt + " <CCC'.$$$$$$????$$$$c' '. ,$$$h
CCC, .,<C>>''', .;CCCCCCCCCCCCC, " + CR
cSt := cSt + " <CCC'<$$F',r=-;-,?$$$.hcccc$$$$$$.`CC> `<C,.;CCC>
<CCCCCCCCCCCCCCC, " + CR
cSt := cSt + " CCC <$$cJ'P'' Jf<$$??$$$$$$$$$$$ C> ;
C<CC'''C,cCCCCCCCCCCCC><CCC, " + CR
cSt := cSt + " `>>> ?$$L_ - ,c$$i?$$<?$$$$$$$$$$ C, ,C' .,. <'''CCCCC><CCCC<C>
CCCC " + CR
cSt := cSt + " <C> '$$$$$$$$$$$$$$$h?$$$$$$$$$ CC <',$$$$cc$ ``'CCC> CCC>,cC
<CCC " + CR
cSt := cSt + " CC>>.`$$$$$$$$$$>J$$?>?$$$$$$$$ CC z?$$$$$$$h<C,. <C <CC
<CC;.`'' " + CR
cSt := cSt + " `C> >.`?$$$$$$$$h<,;,c$$?$$$$$$ C' ;L _`'?$$$$$$$$hr` C')
CC(`<C,. " + CR
cSt := cSt + " `<>.`; ?$$$$$$$$$???'.,c$$$$$','.,.. $$, $$$$$$$$$$$ `,c,`<C>
CC " + CR
cSt := cSt + " `;C>. '$$$$$$;ccc??73$$$$' > J$$$$F<$$$$$$$$$' ``'?$$$c
`')>'CC,.' " + CR
cSt := cSt + " `<CC> `?$$$$$$$$6$$$$$P'. <$$$$$F`$$$??$$$$$`?' '$$$$cr >
C>>> " + CR
cSt := cSt + " <>./>;'`-,`'?$$$$$$$$P',J$. $$$$$$F $??c;?>J$$hc,.,c$$$$' <>.';
" + CR
cSt := cSt + " ``' ,r<$$$hc,,.`''.,c$$$$$ ''??$h ?hc`'=c$$$$$$$$$$$$',c' '
" + CR
cSt := cSt + " zJ$$C;$$$$$$$$$$$$$$$$$$$:c, --,.' $L;,-cd$$$$$?????' -cc,
" + CR
69
cSt := cSt + " .,c$$$$$$$$$$$$$$$$$$$$$$$$$$:$$$cc `C,`?$$$$$$$??;it$' <$cc`?$c
" + CR
cSt := cSt + " .z$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$:$$$$$$c,`\..''''$$$P''_,ccc$$$L,$$c
" + CR
cSt := cSt + " z$$$$$$$$$$$$$$'.,.`' .`?$$$$$$$$$$$$$$$$$$c CC',$ ,cd$$$$$$$$$$$$$$
" + CR
cSt := cSt + " $$$$$$$$$$$$$P' `'??$c,h.'?$$$$$$$$$$$$$$$$$.'' '.zJ$$$$$$$$$$$$$$$$$F
" + CR
cSt := cSt + " .`'$$$$$$$$$$ `?$$hc$$$$$h ?$$$$$$$$$$$$$$P',cd$$$$$$$$$$$$$$$$$$$$$$F
" + CR
cSt := cSt + " CC,.'?$$$$$$$ =ccc,J$$$$$$Lcc,.,,;,.```''',J$$$$$$$$$$$$$$$$$$$$$$$$$
$. " + CR
cSt := cSt + " CCCC>;.'?$$$$$- ''?$$$$$$$$$$$$$$$$$$$$$c$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$> " + CR
cSt := cSt + " `'<CCCC>.'?$$$c`'??$$$$$?$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$P'$$$$$$$$$$$$?
" + CR
cSt := cSt + " CC;,.`<<<>,.,,,<;,.`''''`?$$$$$$$$$$$$$$$???$$$$$$$$P' zJ$$$$$$$$$??iJ
" + CR
cSt := cSt + " CCCCCCC>;.`<<CCCCCCCCC;<>;,.`'??$$$$$$C$$$$C$?$???'',c$$$$$$$$$$$$$$$
$r " + CR
cSt := cSt + " `<<CCCCCCCC>;. ``'<<<<<<>>''', --..`''`''??'' ,;;i$$$$$$$$$$$$$$$$$$$
$F " + CR
cSt := cSt + " C>;,.,,cC,.,,,;<>;;;,,, .;CCC,;> ,;;,. .,.,,. CCCC$$$$$$$$$$$$$$$$$$
$>>c, " + CR
cSt := cSt + " CCCC,`'<CCCCCCCCCCCCC' ,<CCCC'.;CCCC>''.,.`'< <CC$$$$$$$$$$$$$$$$$??
><J$$c " + CR
cSt := cSt + " CCCCCC>;.`'<<CCCCCC> ,CCC>'',-''<>''.;CCCCCC; <CC$$$$$$$$$$$$$$$$$C$$$
$$$$ " + CR
cSt := cSt + " ' `''.,,,;;,.`C''' <C>' ,-- .;;> CCCCCCCCCCC <CCC$$$$$$$$$$$$$$$$$$$$
$$$$ " + CR
cSt := cSt + " <CCCCCCCCCCCCC,.`'''.,,-'.;CCC,'> CCCCCCCCCCC,`CCC$$$$$$$$$$$$$$$$$$$$
$$$$ " + CR
cSt := cSt + " CCCCCCCCCCCCCCCC,.`''.,;<CCCCC>.> CCCCCCCCCCCC <CC$$$$$$$$$$$$$$$$$$$$
$$$$ " + CR
cSt := cSt + " CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC>, <CCCCCCCCCCCC> CC$$$$$$$$$$$$$$$$$$$$
$$$$ " + CR
cSt := cSt + " CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC > <CCCCCCCCCCCCC,`CC$$$?????'''''''''??
$$$$ " + CR
cSt := cSt + " CCCCCC>''CCCCCCCCCCCCCCCCCCCC> ; <CCCCCCCCCCCCCC,`'.,cccd$$$$$$$$$$
$cc,'?$ " + CR
cSt := cSt + " CCCCCCC CCCCCCCCCCCCCCCCCCCCC ;' CCCCCCCCCCCC>' ,c$$$$$$$$$$$$$$$$$$$$
$h,$ " + CR
cSt := cSt + " CCCCCCC `CCCCCCCCCCCCCCCCCCCC,< <CCCCCCCCCC>',c$$$$$$$$$$$$$$$$$$$$$$$
$$$$ " + CR
cSt := cSt + " CCCCCCC <<<CCCCCCCCCCCCCCCCC> <CCCCCCCCCC> $$$$$$$$$$$$$$$$$$$$$$$$$
$$$$ " + CR
cSt := cSt + " CCCCCC> <<<<CCCCCCCCCCCCCCC> <>.<CCCCCCCCC J$$$$$$$$$$$$$$$$$$$$$$''
'$$$ " + CR
cSt := cSt + " CCCCCC <<<<<<<CCCCCCCCCC>>> <C'<CCCCCC>>> $$$$$$$$$$$$$$$$$$$$$'.
'$c '$ " + CR
cSt := cSt + " CCCCCC `<<<<<<<<<<<<<>>>>>>' ' <<<<<>>>>> $$$$$$$$$$$$$$$$$$$$$.`?
b`?$c " + CR
cSt := cSt + " CCCCCC -;-;-;-;-;-;-;-;;;;;,,,,,........ <$$$$$$$$$$$$$$??$$$$$
$h.'h.'?$ " + CR
cSt := cSt + " CCCCCC ,,;;;; ,;;, ,, ,,. `''''''''''''. J$$$$$$$$$$$$C?'J$$$$$$$
$.`?h.' " + CR
cSt := cSt + " CCCCC> ,cCCCC',cCC ;CC CCC> <>;;,, ;;, CCC $$$$$$$$$$$$$$$ ''?$F ..`'-
?$c " + CR
cSt := cSt + " CCCCC CCCCC> CCCC CCC CCCC>'CCCCC, <C,'C> $$$$$$$$$$$$$$$ $ccc,`'$
$hc, '$ " + CR
70
cSt := cSt + " CCCC> <CCCCC'<CCCC,)CC <CCCC,`'CCCC,'CC;<C $$$$$$$$$$$$$$F,$$$$$$c,
''??' " + CR
cSt := cSt + " '''' `<<CCCC <CCCC>'CC.`CCCC> <CCCCC,<CCCC $$$$$$$$$$$$$',$$$$$$$$$$c
" + CR
cSt := cSt + " CCC>' .;..`''<<CCCC,cCC CCCCC><CCCCCCCCCC>,$$$$$$$$$$$$',$$$$$$$$$$$$c
" + CR
cSt := cSt + " C> ,<CCCC>''.,;,,.```---<CCCCCCCCCCCCCCCC <$$$$$$$$$$$' $$$$$$$$$$$$$
$c " + CR
cSt := cSt + " CCCCCC>'.;<CCCCCCCCCC;;,, `'''<CCCC>>>''',J$$$$$$$$$' :, ?$$$$$$$$$$$$
$ " + CR
cSt := cSt + " CCCCC ,<CCCCCCCCCCCCCCC' z$$$cc,`' ,$c=$$$$$$$$$$?$' ::`: '$$$$$$$$$$$
$c, " + CR
cSt := cSt + " CCCCCCCCCCCCCCCCCCCCCC ,J$$$$$$$$$c,' .',??$$$$$$c `: .::. '$$$$$$$$$
$$$ " + CR
cSt := cSt + " CCCCCCCCCCCCCCCCCCCCC z$$$$$$$$$$$$$CC;,`,, $$$$$$ ..::'..::. '$$$$$$$
$$C " + CR
cSt := cSt + " CCCCCCCCCCCCCCCCCCCCC $$$$$$$$$$$$$$$$$CCcc,, '?$F .....:::... `?$$$$$
$$>c " + CR
cSt := cSt + " CCCCCCCCCCCCCCCCCCCCC ?$$??$$$$$$$$$$$$$$$C'?$hc ``:::': ``'``. '?$$$
$$$$ " + CR
cSt := cSt + " CCCCCCCCCCCCCCCCCCCCC> '??<$$$$$$$$$$$$$$$$$c,`?<> :..` ...`.::: J$$$$
$$$$ " + CR
cSt := cSt + " CCCCCCCCCCCC>>>>''''..,;, `'?$$$$$$$$$$$$F'?$$h.`?.`:: .:::'`,J$$$$$
$P'' " + CR
cSt := cSt + " `'''' .-;> `'!' <!'`.,;!;, '??$$$$.`'?$h.`?$$h. .`:'.. . ,$$$$
$P''.: ` " + CR
cSt := cSt + " !!,;, `<' - ``,;<!!'' ,;;;;,''?$$c,`?$$. '?$$.` :'' : P;J$
$P .::' ` " + CR
cSt := cSt + " !!!!!>;,`' .>',, `,;<!!! ;,-`.',!'''- '?$h.`?$h. '?$h. .'.:
`'''. :..:::: " + CR
cSt := cSt + " !!!!!!' ./'`.>',;!!!..' `!''`'.,;;;!!''- '== '?$c '?$r .:::':''
`''` .. " + CR
cSt := cSt + " !!!!' .< ,;!' <!!!!!!'
``,;;!!!'``.,;;;!!,,,.,..`.,..,..,.. ,;;;!!!! " + CR
cSt := cSt +
" !!' ;!' ;'`,;!'' ;-',;!!!!!!;;!!!!!!!!!!!''''''''''''`!!!!!!!;;!!!!!!!! " + CR
cSt := cSt + " ' .<' ;!' <!!! ,''
' ,;!!!!!!!!!!!!!!!!!'`.,;;;;;;;;!!!;;;,.```!!!!!!!!!!! " + CR
RETURN NIL
71
DRAWING - Drawing
The following example shows how to draw with primitives, like circles and lines.
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
72
#include "hmg.ch"
Procedure Main()
GraphTest.Center
Activate Window GraphTest
Return
DRAW GRAPH ;
IN WINDOW GraphTest ;
AT 20,20 ;
TO 400,610 ;
TITLE "Vendita" ;
TYPE BARS ;
SERIES aSer ;
YVALUES { "Jan", "Feb", "Mar", "Apr","May" } ;
DEPTH 15 ;
73
BARWIDTH 15 ;
HVALUES 5 ;
SERIENAMES { "Cars" } ;
COLORS { { 128, 128, 255 } } ;
3DVIEW ;
SHOWGRID ;
SHOWXVALUES ;
SHOWYVALUES ;
SHOWLEGENDS ;
NOBORDER
Return
#include "hmg.ch"
FUNCTION Main()
DEFINE TOOLBAR tb ;
74
PARENT Form_1 ;
BUTTONWIDTH 50 ;
BUTTONHEIGHT 50 ;
BORDER .T.
END TOOLBAR
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
76
RETURN NIL
#INCLUDE "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
-w3
prova.rc
prova.prg
#include "hmg.ch"
78
Procedure Main()
Return
#include "hmg.ch"
FUNCTION Main()
79
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 900 ;
HEIGHT 600 ;
TITLE "Giovanni" ;
MAIN
END WINDOW
Form_1.Test.Object:Navigate("www.elektrosoft.it")
RETURN NIL
80
#include "hmg.ch"
FUNCTION Main()
RETURN NIL
81
ACTIVEX - Viewing a movie from Youtube
This example shows how to view a movie (flash) from Youtube, by an ActiveX.
#include "hmg.ch"
FUNCTION Main()
82
PARENT Form_1 ;
WIDTH 560 ;
HEIGHT 400 ;
PROGID "ShockwaveFlash.ShockwaveFlash.9"
Form_1.Test.Object:Movie := "http://www.youtube.com/v/B43JyTSknl0"
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
Form_1.Test1.Object:Movie := "http://www.youtube.com/v/B43JyTSknl0"
Form_1.Test2.Object:Movie := "http://www.youtube.com/v/sDbYCI8G0nc"
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
Form_1.Test.Object:url := "cavallo.wav"
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
FUNCTION Pressed()
LOCAL oExcel, oSheet
oExcel := CreateObject( "Excel.Application" )
oExcel:WorkBooks:Add()
oSheet := oExcel:ActiveSheet()
oSheet:Cells:Font:Name := "Arial"
oSheet:Cells:Font:Size := 12
oSheet:Columns( 1 ):AutoFit()
oSheet:Columns( 2 ):AutoFit()
oSheet:Cells( 4, 2 ):Select()
oExcel:Visible := .T.
RETURN NIL
86
OLE - Creating a Word document
This example shows how to create a Word document, by OLE.
#include "hmg.ch"
FUNCTION Main()
Form_1.Activate
RETURN NIL
FUNCTION Pressed()
LOCAL oWord, oText
oText := oWord:Selection()
oWord:Visible := .T.
oWord:WindowState := 1
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
DEFINE WINDOW Form_1 WIDTH 400 HEIGHT 300 TITLE "Giovanni" MAIN
END WINDOW
@ 20,90 LABEL titolo PARENT Form_1 WIDTH 240 VALUE "Difference between two dates"
@ 100,140 TEXTBOX data1 PARENT Form_1 WIDTH 110 INPUTMASK "99/99/9999"
@ 130,140 TEXTBOX data2 PARENT Form_1 WIDTH 110 INPUTMASK "99/99/9999"
88
@ 180,140 TEXTBOX diffe PARENT Form_1 WIDTH 110 READONLY
@ 180,270 BUTTON bottone PARENT Form_1 CAPTION "Calculate" ONCLICK calculate()
RETURN NIL
FUNCTION calculate()
LOCAL nDifference
nDifference := Abs( CToD( Form_1.data1.value ) - CToD( Form_1.data2.value ) )
Form_1.diffe.value := AllTrim( Str(nDifference ) )
RETURN NIL
#include "hmg.ch"
FUNCTION Main()
DEFINE WINDOW Form_1 WIDTH 400 HEIGHT 400 TITLE "Finestra di Giovanni" MAIN
89
END WINDOW
@ 50,50 LABEL rettangolo PARENT Form_1 WIDTH 200 HEIGHT 100 BACKCOLOR {255,0,0}
@ 20,100 TEXTBOX base PARENT Form_1 WIDTH 110
@ 90,260 TEXTBOX altezza PARENT Form_1 WIDTH 110
@ 180,50 BUTTON bottone PARENT Form_1 CAPTION "Calculate area and perimeter" WIDTH 210
ONCLICK calculate()
@ 220,50 TEXTBOX area PARENT Form_1 WIDTH 110 READONLY
@ 250,50 TEXTBOX perimetro PARENT Form_1 WIDTH 110 READONLY
RETURN NIL
FUNCTION calculate()
LOCAL nArea, nPerimeter
nArea := Val( Form_1.base.value ) * Val( Form_1.altezza.value )
nPerimeter := ( Val( Form_1.base.value ) + Val( Form_1.altezza.value ) ) * 2
Form_1.area.value := AllTrim( Str(nArea ) )
Form_1.perimetro.value := AllTrim( Str(nPerimeter ) )
RETURN NIL
Appendix A - Photos
90
91
92
Appendix B - Contributors
93
Giovanni Di Maria (he is still the main developer)
Wow Giovanni !!! Congratulations, very nice :-) It is a great contribution to the dissemination of
HMG. Best regards. (Claudio).
It is really a wonderful and great contribution Giovanni. I am making this thread sticky so that
beginners can reach the link easily. (Rathinagiri)
GENIAL !!! (Antonio Montagut)
Hi, Giovanni. To echo Claudio: Wow! There's some really good stuff in there -- thank you. (I
wish it had been there when I started!). Thanks again. (CalScot)
Fine work! (Mol)
Hi Giovanni. Extremely wonderful and fantastic. I appreciate as myself and by name of
community. Thanks from us to you. (Esgici)
Buen trabajo Giovanni. Saludos desde Buenos Aires Argentina (Danielmaximiliano)
Very nice job Giovanni ! Grande Giovanni !!! Congratulations and thank you for your contrib !!!
(Pablo Cesar)
Very good Giovanni ...! Another excellent contribution ..! Thank you. (Kardex Pyme Sofware)
Muy bien Giovanni...! Otro aporte excelente..! Gracias. (Kardex Pyme Sofware)
Excellent contribution to the Community Harbour, Giovanni ... Thanks! (Andres Ortiz Diaz)
Congratulations Giovanni !!! (Fouednoomen)
Hello Giovanni. That will be a great treasure for HMG users most especially the newbies. That
one really shortens the learning curve of Clipper programmers who wishes to migrate their
apps using HMG. Thanks and I really appreciate the work you have done. It's the beauty of the
open source where everyone had a big heart. Congratulations! Regards, Danny. (dhaine_adp)
Exelente aportacion... Polo. Excellent contribution ... Polo. (Leopoldo Blancas)
Very nice job Giovanni, especially for us beginners. Thank you. Nikos (Quartz565)
Excelente trabajo. Gracias (Agustin)
Great work. (Antonio Montagut)
Many Thanks for the wonderful tutorial Giovanni. Wonderful work. Greetings from Germany.
(Klauskugel)
Thanks Giovanni. Especially GRID and Resource samples are useful. Ciao. (Esgici)
Gracias maestro Giovannii ! (Wilson Gamboa)
Exelente Giovanni... Saludos desde México... Polo (Leopoldo Blancas)
Fabuloso tus ejemplos Giovanni. Gracias por compartir. (Danielmaximiliano)
Hi Giovanni, Thank you very much for the update. So tell us how many hours is your one day?
It seems like your one day is more than 24 hours or you are simply having an excellent time
managing skills. Well the truth is your contribution is now becomes a de facto "MUST READ
DOCUMENT" aside from the official HMG Users Manual. Your straight forward approach was
indeed very inspiring and certainly leads anyone who had a basic understanding of Clipper to
become a fellow HMGians. God Bless you for your unselfish contributions and of course to
everyone of us. Regards ,Danny. (Dhaine_adp)
A picture is worth a thousand words !!! This is an excellent tutorial, is easy, effective and
beautiful !!! What do you think about including the link to the page of the tutorial in the
documentation of HMG? (Srvet_claudio)
94
Exelente contribución.. Polo. (Leopoldo Blancas)
Hermoso!!! (Fchirico)
Wonderful. I can understand how hard is that to create a manual like this. (Rathinagiri)
Very good work! (Chrisjx2002)
Hi Giovanni. Thank you so much for the wonderful work. Nikos. (Quartz565)
Appendix D - Communities
95