Page 2 of 16
Re: HMG 4 Started
Posted: Fri Aug 13, 2010 2:00 pm
by Rathinagiri
Thanks for the advice Roberto.
Now I have changed the code/demo as per your instructions. Kindly check and tell me, so that I can proceed further.
Re: HMG 4 Started
Posted: Fri Aug 13, 2010 2:29 pm
by Rathinagiri
Hi Roberto,
Is there a way for these two things as we have already used upto HMG 3?
1. How to define the events as we have done in semi-oop style.
For example, instead of win1:checkbox:value := .t. we have to use win1.checkbox1.value := .t.
2. Can we omit the code blocking characters?
For example:
define checkbox c
row 10
col 10
onchange checkboxchangefunction() // and not onchange {||checkboxchangefunction()}
caption "A Checkbox"
end checkbox
Re: HMG 4 Started
Posted: Fri Aug 13, 2010 2:43 pm
by Roberto Lopez
rathinagiri wrote:Hi Roberto,
Is there a way for these two things as we have already used upto HMG 3?
1. How to define the events as we have done in semi-oop style.
For example, instead of win1:checkbox:value := .t. we have to use win1.checkbox1.value := .t.
It is automatically done via two 'tricks' already in place, so, you must do nothing.
The first one is that the control variable name (stringuified) is added as an instance variable to the control parent window, allowing this:
Window:Control:Property
This is done in the Create() method via the following line:
::oParent:AddData ( ::cName , Self )
It must be present in the Create() method for every control (AddData() is a method in Window class that do the thing).
The second one is the following directive in hmg.ch:
#xtranslate .<!msg!> => :<msg>
Allowing to write:
Window:Control:Property
As:
Window.Control.Property
rathinagiri wrote:
2. Can we omit the code blocking characters?
For example:
define checkbox c
row 10
col 10
onchange checkboxchangefunction() // and not onchange {||checkboxchangefunction()}
caption "A Checkbox"
end checkbox
We could do it 'blockifiying' it in #command definitions but, let me assure that this do not bring problems when you want to work with code blocks.
I'll do a definitive answer about that later.
Re: HMG 4 Started
Posted: Fri Aug 13, 2010 3:06 pm
by Roberto Lopez
rathinagiri wrote:Thanks for the advice Roberto.
Now I have changed the code/demo as per your instructions. Kindly check and tell me, so that I can proceed further.
This is it... It looks good!!!
Re: HMG 4 Started
Posted: Fri Aug 13, 2010 3:30 pm
by Roberto Lopez
Roberto Lopez wrote:
It is automatically done via two 'tricks' already in place, so, you must do nothing.
The first one is that the control variable name (stringuified) is added as an instance variable to the control parent window, allowing this:
Window:Control:Property
This is done in the Create() method via the following line:
::oParent:AddData ( ::cName , Self )
It must be present in the Create() method for every control (AddData() is a method in Window class that do the thing).
The second one is the following directive in hmg.ch:
#xtranslate .<!msg!> => :<msg>
Allowing to write:
Window:Control:Property
As:
Window.Control.Property
And when you create a window using DEFINE WINDOW command its object variable is made public:
__MVPUBLIC ( <"oObj"> ) ;;
So, you can use the syntax:
Window.Control.Property
at any place of your application, exactly like standard HMG.
Please note that must use DEFINE WINDOW to achieve this since there is not pre-processing when you use raw objects (ie):
oWindow := Window:New()
Re: HMG 4 Started
Posted: Fri Aug 13, 2010 3:40 pm
by sudip
Hello,
TortoiseSVN works!
Testing samples now.
Then I shall go through souce code and understand.
Then I shall contribute from my side.
Sorry, I am slow this time

(but I shall understand first)
Roberto, thanks for your explanation.
Rathi, as you said - I am also going to talk less more work

Thank you friend.
After 5 min:
In textbox sample 2 (demo_2.prg), I found following lines:
Code: Select all
@ 10 , 40 TextBox Text1 ;
Width 200 ;
Value 'OOP TextBox 1 !!!'
So, I suppose Text1 has initial value 'OOP TextBox 1 !!!'. But, it is not shown and when I click on Button1, MsgInfo( Win1:Text1:Value ) shows blank. I suppose initialization of value property during textbox definition is will be added later. Am I correct?
Re: HMG 4 Started
Posted: Fri Aug 13, 2010 4:00 pm
by sudip
Roberto Lopez wrote:
And when you create a window using DEFINE WINDOW command its object variable is made public:
__MVPUBLIC ( <"oObj"> ) ;;
So, you can use the syntax:
Window.Control.Property
at any place of your application, exactly like standard HMG.
Please note that must use DEFINE WINDOW to achieve this since there is not pre-processing when you use raw objects (ie):
oWindow := Window:New()
And when we write
Code: Select all
Local oWindow
With Object oWindow := Window():New()
Here, oWindow is local.
Moreover ACTIVATE WINDOW command works with both local and public window object.
Re: HMG 4 Started
Posted: Fri Aug 13, 2010 4:12 pm
by Roberto Lopez
sudip wrote:
After 5 min:
In textbox sample 2 (demo_2.prg), I found following lines:
Code: Select all
@ 10 , 40 TextBox Text1 ;
Width 200 ;
Value 'OOP TextBox 1 !!!'
So, I suppose Text1 has initial value 'OOP TextBox 1 !!!'. But, it is not shown and when I click on Button1, MsgInfo( Win1:Text1:Value ) shows blank. I suppose initialization of value property during textbox definition is will be added later. Am I correct?
You are right. It must be added in Create() method at textbox.prg.
Regarding contributing I guess that the best way to go is that (at least for now) each contributor pick one control. ie: rathinagiri has took checkbox.
Re: HMG 4 Started
Posted: Fri Aug 13, 2010 4:27 pm
by sudip
Hello,
I just noted a very interesting thing. Now we can use control object directly, without using window object
Code: Select all
With Object oWindow := Window():New()
...
With Object oButton2 := Button():New()
:Row := 140
:Col := 40
:Caption := 'Change Caption'
:OnClick := { || oButton2:value := 'Caption Changed' }
End With
...
oButton2:value := 'Caption Changed'

Re: HMG 4 Started
Posted: Fri Aug 13, 2010 4:48 pm
by apais
A changelog file in the main svn folder would be usefull =)