Instantiating the QT object in the NEW method
Moderator: Rathinagiri
Instantiating the QT object in the NEW method
Hi.
I moved the instantiation of the associated QT object in window.prg from the CREATE to the NEW method.
I tested all the samples and none of them presented problems or different behavior, so I committed to SVN.
In fact, in the old fashion, samples\statusbar\demo_4.prg didn´t perform correct and in the new one it does. The icons were not associated because the window wasn´t instantiated.
I moved the instantiation of the associated QT object in window.prg from the CREATE to the NEW method.
I tested all the samples and none of them presented problems or different behavior, so I committed to SVN.
In fact, in the old fashion, samples\statusbar\demo_4.prg didn´t perform correct and in the new one it does. The icons were not associated because the window wasn´t instantiated.
[[]] Mauricio Ventura Faria
Re: Instantiating the QT object in the NEW method
Hi Mauricio, many thanks.
Please, take a look at the end of viewtopic.php?f=5&t=1873&start=40
Cheers
Please, take a look at the end of viewtopic.php?f=5&t=1873&start=40
Cheers
Luigi from Italy
www.L3W.it
www.L3W.it
Re: Instantiating the QT object in the NEW method
Hi Mauricio,
I look at your code, but I can't compile example. Why? Because I don't have the libHbQtxxxx.a libraries in according with Harbour compiler distribuited with HMG. I have the new (with standard Harbour distribution), but they can't work with HMG because there are some differences; in fact, we are waiting the start (from MrDuck) to do some changes in HMG4 about Qt functions.
For this reason I remember to every one: don't change your Harbour installation with the new version to compile HMG programs.
Now I will do a merge of the current HMG version to a hybrid HMG version.
Cheers
I look at your code, but I can't compile example. Why? Because I don't have the libHbQtxxxx.a libraries in according with Harbour compiler distribuited with HMG. I have the new (with standard Harbour distribution), but they can't work with HMG because there are some differences; in fact, we are waiting the start (from MrDuck) to do some changes in HMG4 about Qt functions.
For this reason I remember to every one: don't change your Harbour installation with the new version to compile HMG programs.
Now I will do a merge of the current HMG version to a hybrid HMG version.
Cheers
Luigi from Italy
www.L3W.it
www.L3W.it
Re: Instantiating the QT object in the NEW method
Hi Mauricio, I've done some test, but...
I can not figure out if: I forgot something, I misunderstood something or is there some big problem
I write this code:
This doesn't work: win1:Center() Why?
Cheers
I can not figure out if: I forgot something, I misunderstood something or is there some big problem
I write this code:
Code: Select all
#include "hmg.ch"
MEMVAR win1
FUNCTION Main
LOCAL oWindow
PUBLIC win1
hbQt_ErrorSys()
WITH OBJECT oWindow := Window():New()
:Name := "win1"
:Fontname := "Helvetica"
:Row := 10
:Col := 10
:Width := 400
:Height := 400
:Title := "Nice OOP Demo!!!"
:Type := WND_MAIN
:OnInit := { || Main_OnInit() }
END WITH
oWindow:Activate()
RETURN NIL
STATIC FUNCTION Main_OnInit()
win1:Center()
RETURN NIL
Cheers
Luigi from Italy
www.L3W.it
www.L3W.it
Re: Instantiating the QT object in the NEW method
Hi Mauricio, other...but it's the same
The last win1:Label1:Caption() it does'nt work
Cheers
Code: Select all
#include "hmg.ch"
MEMVAR win1
FUNCTION Main
LOCAL oWindow
PUBLIC win1
hbQt_ErrorSys()
WITH OBJECT oWindow := Window():New()
:Name := "win1"
:Fontname := "Helvetica"
:Row := 10
:Col := 10
:Width := 400
:Height := 400
:Title := "Nice OOP Demo!!!"
:Type := WND_MAIN
:OnInit := { || oWindow:Center() }
WITH OBJECT Label():New()
:Name := "label1"
:Row := 20
:Col := 40
:Width := 200
:Value := 'OOP LABEL!!!'
END WITH
WITH OBJECT Button():New()
:Name := "button1"
:Row := 160
:Col := 40
:Width := 180
:Caption := "Show FontName"
:OnClick := { || Button1_OnClick() }
END WITH
END WITH
oWindow:Activate()
RETURN NIL
STATIC FUNCTION Main_OnInit()
// win1:Center() It doesn't work
RETURN NIL
STATIC FUNCTION Button1_OnClick()
MsgInfo( win1:Label1:Caption() , "Label CAPTION" )
RETURN NIL
Cheers
Luigi from Italy
www.L3W.it
www.L3W.it
Re: Instantiating the QT object in the NEW method
Hi Luigi !
The window object is oWindow and you are referencing win1...
I see you "named" it win1 but, is this supposed to be valid in HMG ?
The window object is oWindow and you are referencing win1...
I see you "named" it win1 but, is this supposed to be valid in HMG ?
[[]] Mauricio Ventura Faria
Re: Instantiating the QT object in the NEW method
Hi Mauricio,
the name it's mandatory for a lot of reason!
1) In this way is very easy to refer to various objects in the program. On the other hand, the name "win1" is the object oWindow but it's named "win1". Of course it's HMGx
2) Within a program, as you can get or set a value of a form or a control of this form? examples:
3) Backward compatibility
My suggestion: you must think in standard XBase style but solve with object.
Cheers
the name it's mandatory for a lot of reason!
1) In this way is very easy to refer to various objects in the program. On the other hand, the name "win1" is the object oWindow but it's named "win1". Of course it's HMGx
2) Within a program, as you can get or set a value of a form or a control of this form? examples:
or you prefer thiscVarName1 := oWindow1:oControl1:Value // oWindow1:oControl1:Value := "luigi" and
cVarName2 := oWindow2:oControl1:Value // oWindow2:oControl1:Value := "Mauricio" and...
Perhaps, in a complete Object Oriented Program works fine, but not in this situation.cVarName1 := win1:FirstName:Value // win1:FirstName:Value := "Luigi" and
cVarName2 := win2:FirstName:Value // win2:FirstName:Value := "Mauricio" and...
3) Backward compatibility
My suggestion: you must think in standard XBase style but solve with object.
Cheers
Luigi from Italy
www.L3W.it
www.L3W.it
Re: Instantiating the QT object in the NEW method
Hi Luigi.
Don´t know about HMG3, but seems that this never worked in HMG4...
I tested older versions from sourceforge.net and none of them worked.
Don´t know about HMG3, but seems that this never worked in HMG4...
I tested older versions from sourceforge.net and none of them worked.
[[]] Mauricio Ventura Faria
Re: Instantiating the QT object in the NEW method
Ok Mauricio.
perhaps HMG4 has problems? For example take a look at "samples\button\demo_3.prg" and you can see HMG3 style and HMG4 style.
Cheers
perhaps HMG4 has problems? For example take a look at "samples\button\demo_3.prg" and you can see HMG3 style and HMG4 style.
Cheers
Luigi from Italy
www.L3W.it
www.L3W.it
Re: Instantiating the QT object in the NEW method
Hy guys,
I must say I'm sorry to Mauricio and everyone because I do a mistake
I give a wrong information about form. This is my mistake:
The good one is
I'm very sorry.
Best regards
I must say I'm sorry to Mauricio and everyone because I do a mistake
I give a wrong information about form. This is my mistake:
Code: Select all
WITH OBJECT oWindow := Window():New()
:Name := "win1"
Code: Select all
WITH OBJECT win1 := Window():New()
Best regards
Luigi from Italy
www.L3W.it
www.L3W.it