syntax: Xbase (old HMG3) and OOP (new HMG4)

Moderator: Rathinagiri

User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

syntax: Xbase (old HMG3) and OOP (new HMG4)

Post by l3whmg »

Hi friends.
I was applying the solution to the problem when you press ENTER, when I noticed a lot of problems inside "HMG.ch".

I will give you an example: TEXTBOX. Within "HMG.CH" I can find this:

Code: Select all

DEFINE TEXTBOX <oObj>..... => With Object <oObj> := TEXTBOX():New( <"oObj">..........
I think, this code it's wrong. The right is:

Code: Select all

DEFINE TEXTBOX <oObj> ..... => With Object TEXTBOX():New( <"oObj">..........
Why is this right?
1) With use of switch "/w3" (Harbour compiler) you can find a lot of errors: many var are undeclared and so on. With "/w0", obviously, no errors but not every time.
2) Because with XBase (old HMG3) we have this syntax: FormName.ControlName.Value and not ControlName.Value And the first syntax do it.
3) On the other hand, with HMG4 parent system, we can use "FormName:ControlName:Value" without problem. I've tested.

So, in my program I write:

Code: Select all

DEFINE TEXTBOX NameOfTextbox
....
END TEXTBOX
without the need to clarify "NameOfTextbox" as a var.

If I write with OOP (new HMG4) syntax, the problem is different, because I apply directly the OOP syntax to my program:

Code: Select all

WITH OBJECT NameOfTextbox := TEXTBOX():New()
........
END WITH
I must manage "NameOfTextbox" as "public", "local" or "private" as I like it.

It's my mystake/misunderstanding? What do you think?
I can clean "HMG.ch" before a commit, but I want your opinion.

Best regards
Luigi from Italy
www.L3W.it
mrduck
Posts: 497
Joined: Fri Sep 10, 2010 5:22 pm

Re: syntax: Xbase (old HMG3) and OOP (new HMG4)

Post by mrduck »

l3whmg wrote:I can clean "HMG.ch" before a commit, but I want your opinion.
Luigi, the good part of using svn is that we can always revert a change if necessary.... I don't think there are problems since New( oObj... takes care of creating the data member oObj... there are of cource exceptions as I told you pm, for example when we want to use class members as objects:
DEFINE TEXTEDIT ::myTextEdit <-- this won't work
DEFINE TEXTEDIT otherWindow:myTextEdit <-- this won't work
WITH OBJECT otherWindow:myTextEdit := TEXTEDIT():New() <-- this works
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: syntax: Xbase (old HMG3) and OOP (new HMG4)

Post by l3whmg »

Hi Mrduck.
I can in agreement with you, but when I try to compile demos (I'm using /w3) I receive a lot of warnings / errors.
Why? Because HMG.ch have "With Object <oObj> := ...." and source program don't handle vars.
I can leave this syntax: no problem for me.

Cheers.

P.S. all fine your weekend?
Luigi from Italy
www.L3W.it
mrduck
Posts: 497
Joined: Fri Sep 10, 2010 5:22 pm

Re: syntax: Xbase (old HMG3) and OOP (new HMG4)

Post by mrduck »

You can proceed with the changes, if a problem will arise we will revert the change
l3whmg wrote: P.S. all fine your weekend?
Bad weather now... I'm at the notebook :-)
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: syntax: Xbase (old HMG3) and OOP (new HMG4)

Post by concentra »

Hi Luigi.
l3whmg wrote:FormName:ControlName:Value" without problem. I've tested.
And we loose the option to reference ControlName:Value.
Sounds bad to me.
In my opinion, defining vars is a programmers problem, not HMG.
If one needs /w3 he must take care of this.

P.S. I use -es2 in all my code and if a var is not defined it rises a compilation error !
[[]] Mauricio Ventura Faria
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: syntax: Xbase (old HMG3) and OOP (new HMG4)

Post by l3whmg »

Hi Mauricio.
Ok, I understand :mrgreen: There are a lot of reason to leave this!
On the other hand there are other problem (ie menu) and /w3 can't used.
Anyway, IMHO /w3 it's a good must to have clean source code.
Cheers
Luigi from Italy
www.L3W.it
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: syntax: Xbase (old HMG3) and OOP (new HMG4)

Post by concentra »

Hi Luigi.
l3whmg wrote:On the other hand there are other problem (ie menu) and /w3 can't used.
I am revising the menus to finish the name in New() method work. And probably address this issue with menus and /w3.

But I have a doubt.
In hmg.ch, when a named menuitem is translated, the menuitem object is added ( AddData() ) to oCurrentWindow.
Is this OK ? Why the window ? Wouldn´t it be added to the menu this item is subordinated ?
Or is this the HMG3 way, so this is compatibility ?

Need to know this to finish the job.
[[]] Mauricio Ventura Faria
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: syntax: Xbase (old HMG3) and OOP (new HMG4)

Post by Rathinagiri »

That is for HMG3 compatibility.

windowname.menuitemname.checked
windowname.menuitemname.enabled

Properties are being used.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: syntax: Xbase (old HMG3) and OOP (new HMG4)

Post by concentra »

Hei, you are fast ! :mrgreen:
rathinagiri wrote:That is for HMG3 compatibility.
windowname.menuitemname.checked
windowname.menuitemname.enabled
Properties are being used.
So, I will preserve this compatibility, and it will also be possible to do windowname.menuname.menuitemname.checked ...
[[]] Mauricio Ventura Faria
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: syntax: Xbase (old HMG3) and OOP (new HMG4)

Post by concentra »

Hi Luigi.
While testing demos I found a problem with C:\hmg.SVN\samples\label\demo_5.prg.
It tries to rename a window and the rename method calls DelData() and DelData() is from Basic class and HMGAPP does not inherit from Basic...
Could you please investigate ?
Thanks.
[[]] Mauricio Ventura Faria
Post Reply