Page 1 of 1
HMGObjects usage
Posted: Thu Jul 15, 2010 1:15 pm
by karweru
Hi Friends,
I downloaded HMG objects and extracted the files to c:\hmg where i have installed Hmg, in the process overwriting some files at the prompt. I've then written the code below, and when i compile it from HMG IDE, i get an 'undefined reference to WINDOW' at line 3
#include "hmg.ch"
Function Main
local oWin:=window():new()
oWin:Name(newWindowName())
oWin:Type(WND_MAIN)
oWin:Row(0)
oWin:Col(0)
oWin:Width(480)
oWin:Height(400)
oWin:Title("myDemo")
oWin:Icon("main.ico")
oWin:MinButton(.t.)
oWin:MaxButton(.t.)
oWin:Sizable(.f.)
oWin:SysMenu(.t.)
oWin:TitleBar(.f.)
oWin:HelpButton(.t.)
oWin:OnInit({||msgInfo("Welcome")})
OWin:OnRelease({||msgInfo()})
oWin:Center()
oWin:Activate()
Kindly guide me what I'm doing wrong. My desire is to develop my applications solely with HMG Objects.
Re: HMGObjects usage
Posted: Thu Jul 15, 2010 5:58 pm
by dhaine_adp
Hi Gilbert,
I downloaded HMG objects and extracted the files to c:\hmg where i have installed Hmg, in the process overwriting some files at the prompt. I've then written the code below, and when i compile it from HMG IDE, i get an 'undefined reference to WINDOW' at line 3
Try adding this line below to your code:
Or better yet, browse on the samples of HMG Objects.
Regards,
Danny
Re: HMGObjects usage
Posted: Thu Jul 15, 2010 6:11 pm
by dhaine_adp
Hi,
In addition, HMG Objects were still in experimental stage. For a serious project I think it is not applicable because if in the future a major change occurs you have to rewrite your program. However for small project it might be fine (I'm not sure though) but it deserves to be tested to its breaking point so that weakness can be found.
You cannot mix the semi-oop syntax when you use HMG Objects. Example, WindowName.Release instead you have to use WindowName:Release(). Thus in effect you cannot use your personal UDF/library if it so happen containing those syntax.
I am not sure if semi-oop syntax can can be overriden by xtranslate or xcommand compiler directives.
On the other hand, here is a makefile if you wish to build HMG Objects as LibHMGObjects:
Code: Select all
HRB_DIR = c:/hmg/harbour
INC_DIR = c:/hmg/include
OBJ_DIR = f:/dad/hmgobjects/source --> replaced this with your source paths or obj path
LIB_DIR = f:/dad/hmgobjects/source --> replaced this with your source paths or lib path
SRC_DIR = f:/dad/hmgobjects/source --> replaced this with your source paths or src path
CFLAGS = -Wall -mno-cygwin -O3
all: \
$(LIB_DIR)/libhmgobjects.a \
$(LIB_DIR)/libhmgobjects.a : \
$(OBJ_DIR)/objects.o
ar rc $@ $^
$(OBJ_DIR)/objects.o : $(OBJ_DIR)/objects.c
$(OBJ_DIR)/objects.c : $(SRC_DIR)/objects.prg
$(HRB_DIR)/bin\harbour.exe $^ -n -I$(HRB_DIR)/include -i$(INC_DIR) -d__WINDOWS__ -o$@ $^
.prg.c:
$(HRB_DIR)/bin\harbour.exe $^ -n -I$(HRB_DIR)/include -i$(INC_DIR) -d__WINDOWS__ -o$@ $^
.c.o:
gcc $(CFLAGS) -c -I$(INC_DIR) -I$(HRB_DIR)/include -o $@ $^
So then from the HMG-IDE you have to specify the library you have created as HMGObjects (If that is the name you have given).
Regards,
Danny
Re: HMGObjects usage
Posted: Fri Jul 16, 2010 6:25 am
by karweru
Thanks Danny. I will try your second solution. HMG Objects has a very attractive goal as stated by Roberto.
Other important design goal was to make it portable. So, different backend GUI
frameworks (GTK, QT, wxWidgets, etc.) could be easily 'pluged-in'.
Though experimental, I trust Roberto to make it happen, and I think if I use it for a real-life program, I might help in testing it to the limits.
Thanks again Danny.
Re: HMGObjects usage
Posted: Fri Jul 16, 2010 8:34 am
by mustafa
Hola karweru
Mire si le sirve este ejemplo
un saludo
*----------------- Google -----------------*
Hello karweru
See if this example serves
greetings
Mustafa
Re: HMGObjects usage
Posted: Mon Jul 19, 2010 7:51 am
by karweru
Thank you so much Mustafa. I downloaded your sample, and I've been able to make mine work now. Thank you again.