TOVAR and TagReference

Moderator: Rathinagiri

Post Reply
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

TOVAR and TagReference

Post by concentra » Wed Dec 07, 2011 3:26 pm

Hi.

I have a question about preprocessing DEFINE clauses.
Why TOVAR clause is needed to set a var that contains the object ?
Why not use <TagReference> as the var name to attribute the object ?
What is the target in doing it separately ?
[[]] Mauricio Ventura Faria

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

Post by l3whmg » Wed Dec 07, 2011 4:27 pm

Hi Mauricio, how are you?
concentra wrote:Why TOVAR clause is needed to set a var that contains the object ?
Because only in some specific conditions (I'm referring XBase style and some new objects like layout and related handling ) you need a var to store the object (at program level) and then use it with some commands. With HMG3 XBase style you don't need it; always you use "formname:labelname:property". To preserve compatibility with previous program, IMHO this solution is better: WHEN you need var, you use TOVAR clause.
concentra wrote:Why not use <TagReference> as the var name to attribute the object ?
I'm sorry, but why do you need to use a "reference" as a var? I remember to you difference between OOP style and XBase style. On the other hand you have to be considered: internal HMG and external HMG. If you use <TagReference> as a var you must always declare this var (LOCAL or PUBLIC or PRIVATE): please take a look to HMG3 program. You never see this usage "tagreference.value"; you always see "form.tagreference.value" or "this.value" (but "this" is translated into "form.tagreference"). With OOP style you use other "syntax"; eg.

Code: Select all

CLASS myClass
  DATA myform......
  METHOD New
..........
As you can see, in this situation (natural with OOP style) you must create myform to have/handle the object.

"DEFINE WINDOW myform" is a semi-oop not a real OOP (but DEFINE WINDOW is translated into a real OOP code ;) ).

Where is the problem?

Cheers
Luigi from Italy
www.L3W.it

User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Post by concentra » Wed Dec 07, 2011 6:12 pm

Hi Luigi !
l3whmg wrote:Hi Mauricio, how are you?
Fine, only a little busy...
l3whmg wrote:Because only in some specific conditions (I'm referring XBase style and some new objects like layout and related handling ) you need a var to store the object (at program level) and then use it with some commands. With HMG3 XBase style you don't need it; always you use "formname:labelname:property". To preserve compatibility with previous program, IMHO this solution is better: WHEN you need var, you use TOVAR clause.
Ok.
I'm sorry, but why do you need to use a "reference" as a var? I remember to you difference between OOP style and XBase style. On the other hand you have to be considered: internal HMG and external HMG. If you use <TagReference> as a var you must always declare this var (LOCAL or PUBLIC or PRIVATE)...
Seems only that this is different than what I use to code...
Where is the problem?
I am coming back here after a while and updated my SVN tree and started to review all demos in order to see what changed and a lot of them are messaging warnings about unused vars. And it is related to this.
I will review the demos in order to complain coding in the way you explained and remove the warnings.
By the way, I also stated problems with missing hmg_qtlocale.ch in agoodstart demos.
Is this deprecated ? If so, may I delete this demos ?
[[]]
[[]] Mauricio Ventura Faria

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

Post by l3whmg » Wed Dec 07, 2011 6:40 pm

Hi Mauricio
concentra wrote:hmg_qtlocale.ch Is this deprecated ?
It's unusefull because I sent to Pritpal all qt defined constants and he is included within HbQt include files. So this line is an error: must be changed with "#include hbqtcore.ch"
concentra wrote:If so, may I delete this demos ?
No! Why do you want delete them? Else, you can tune fine them: removing unused var and so on.... This is better isn'it?

Cheers
Luigi from Italy
www.L3W.it

User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Post by concentra » Fri Dec 09, 2011 10:43 am

l3whmg wrote:It's unusefull because I sent to Pritpal all qt defined constants and he is included within HbQt include files. So this line is an error: must be changed with "#include hbqtcore.ch"
Ok, but I'm still getting an error for QLOCALE_ENGLISH and QLOCALE_GERMAN. The language not the country.
[[]] Mauricio Ventura Faria

Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Post by Ricci » Fri Dec 09, 2011 11:58 am

concentra wrote:
l3whmg wrote:It's unusefull because I sent to Pritpal all qt defined constants and he is included within HbQt include files. So this line is an error: must be changed with "#include hbqtcore.ch"
Ok, but I'm still getting an error for QLOCALE_ENGLISH and QLOCALE_GERMAN. The language not the country.
hmg_qtlocale.ch contains the country and language codes.

hbqtcore.ch only contains the country codes!

You still have to use hmg_qtlocale.ch to call Localized( QLOCALE_GERMAN, QLocale_Germany )

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

Post by l3whmg » Fri Dec 09, 2011 1:28 pm

Hi Ricci and Mauricio.
You are right, Ricci, I don't see that hbqtcore doesn't contains language code. It's very strange because I sent all the codes. On the other hand, the hmg_qtlocale.ch was removed from hmg distribution.

Cheers
Luigi from Italy
www.L3W.it

User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Post by concentra » Fri Dec 09, 2011 3:48 pm

Luigi, is it ok if I restore hmg_qtlocale.ch until the problem is solved ?
[[]] Mauricio Ventura Faria

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

Post by l3whmg » Sun Dec 11, 2011 6:38 pm

Hi Mauricio,
I'm sorry I don't see this message. Anyway, I have done a commit and re-add hmg_qtlocale.ch with languages. You must use with hbqtcore.ch; see demo.

Cheers
Luigi from Italy
www.L3W.it

Post Reply