HMG 4 Started
Moderator: Rathinagiri
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: HMG 4 Started
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.
Now I have changed the code/demo as per your instructions. Kindly check and tell me, so that I can proceed further.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: HMG 4 Started
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
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
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: HMG 4 Started
It is automatically done via two 'tricks' already in place, so, you must do nothing.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.
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
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.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
I'll do a definitive answer about that later.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: HMG 4 Started
This is it... It looks good!!!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.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: HMG 4 Started
And when you create a window using DEFINE WINDOW command its object variable is made public: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
__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()
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
Re: HMG 4 Started
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:
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?
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 !!!'
With best regards,
Sudip
Sudip
Re: HMG 4 Started
And when we writeRoberto 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()
Code: Select all
Local oWindow
With Object oWindow := Window():New()
Moreover ACTIVATE WINDOW command works with both local and public window object.
With best regards,
Sudip
Sudip
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: HMG 4 Started
You are right. It must be added in Create() method at textbox.prg.sudip wrote:
After 5 min:
In textbox sample 2 (demo_2.prg), I found following lines: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?Code: Select all
@ 10 , 40 TextBox Text1 ; Width 200 ; Value 'OOP TextBox 1 !!!'
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.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
Re: HMG 4 Started
Hello,
I just noted a very interesting thing. Now we can use control object directly, without using window object
oButton2:value := 'Caption Changed'
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
...
With best regards,
Sudip
Sudip
Re: HMG 4 Started
A changelog file in the main svn folder would be usefull =)
Angel Pais
Web Apps consultant/architect/developer.
Web Apps consultant/architect/developer.