Font in control class

Moderator: Rathinagiri

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

Font in control class

Post by concentra » Fri Mar 04, 2011 11:58 am

Hi all !

In HMG4 the font property of all objects are initialized when the object is being created.
In this way, in some cases, it´s not possible to set font properties of an object before it´s creation.
And in some classes the font property is not explicitly settled. In this case, since the controls works as expected, I assumed that a default font is previously settled by the QT framework.
I suggest to assign the font property in a lower level, in the CONTROL class, since almost all objects inherits form CONTROL.
And font management methods are already in CONTROL.
And since I will need to change almost all object classes that descends from CONTROL I would hear from you if is this Ok or if I am missing something.
[[]] Mauricio Ventura Faria

User avatar
Rathinagiri
Posts: 5246
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 165 times
Been thanked: 164 times
Contact:

Post by Rathinagiri » Fri Mar 04, 2011 12:56 pm

IMHO, as far as the changes are HMG 3 compatible backward, we can do anything to improve.
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

Post by concentra » Fri Mar 04, 2011 1:49 pm

This may be a problem since I have never used HMG 3...
[[]] Mauricio Ventura Faria

User avatar
Rathinagiri
Posts: 5246
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 165 times
Been thanked: 164 times
Contact:

Post by Rathinagiri » Fri Mar 04, 2011 2:29 pm

No problem. Please go ahead. Let us see what happens.
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

Post by concentra » Fri Mar 04, 2011 3:53 pm

OK. I am confident that no code will be break.
But before I commit the changes, I will test all samples in the SVN.
[[]] Mauricio Ventura Faria

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

Post by l3whmg » Fri Mar 04, 2011 7:15 pm

Hi, forgive me for intruding, but after reading this post I take a look to control.prg and window.prg.
Both contain the definition of the oFont var: why? This is the only case?
The point made is very important and I would add: if there are other cases, perhaps it would be enclosed within control.prg all common properties and methods.

Best regards
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 » Thu Mar 10, 2011 12:52 pm

Hi.
Having some trouble in this task...

OOP is a bit difficult because there are no NEW() method in almost all classes inherited from CONTROL.
In this way, whenever a control is created the NEW() form the control class is called ( inheritance ) but the control is nothing usable, it is only controlling stuff.
It´s not possible to set any specific property before the control is created by the CREATE() method.
Classes inherited from WINDOW does not suffer this lack of NEW() methods.

I have an idea of what to do but since I do not know the innards of the lib and need some help from the seniors !
For me the CREATE() method should be changed to a NEW() method or splitted in a CREATE() and NEW() classes. My guess is that the split approache is the way to go...
[[]] Mauricio Ventura Faria

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

Post by l3whmg » Thu Mar 10, 2011 4:36 pm

Hello Concentra,
I'm not the best qualified to criticize your idea; I'm also experimenting with the new library, the code and the use of classes ;)

I hope that my explanation is not misplaced :roll:

The "CREATE" method is used to create the QT object, while the HMG object has already been created by "NEW" method.
I can describe the flow in this way:
- create objects to the level of HMG ("NEW" method);
- create objects to the level of QT (from form see "ACTIVATE" method);
- Activating the form and bla, bla, bla... :lol:

IMHO, partly agree with you is that - perhaps - it is better to distinguish "NEW" method for each control :idea:
But it's my personal opinion.

Cheers
Luigi from Italy
www.L3W.it

Post Reply