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 »

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:

Re: TOVAR and TagReference

Post by l3whmg »

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

Re: TOVAR and TagReference

Post by concentra »

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:

Re: TOVAR and TagReference

Post by l3whmg »

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

Re: TOVAR and TagReference

Post by concentra »

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

Re: TOVAR and TagReference

Post by Ricci »

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:

Re: TOVAR and TagReference

Post by l3whmg »

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

Re: TOVAR and TagReference

Post by concentra »

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:

Re: TOVAR and TagReference

Post by l3whmg »

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