Page 1 of 1

Font in control class

Posted: Fri Mar 04, 2011 11:58 am
by concentra
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.

Re: Font in control class

Posted: Fri Mar 04, 2011 12:56 pm
by Rathinagiri
IMHO, as far as the changes are HMG 3 compatible backward, we can do anything to improve.

Re: Font in control class

Posted: Fri Mar 04, 2011 1:49 pm
by concentra
This may be a problem since I have never used HMG 3...

Re: Font in control class

Posted: Fri Mar 04, 2011 2:29 pm
by Rathinagiri
No problem. Please go ahead. Let us see what happens.

Re: Font in control class

Posted: Fri Mar 04, 2011 3:53 pm
by concentra
OK. I am confident that no code will be break.
But before I commit the changes, I will test all samples in the SVN.

Re: Font in control class

Posted: Fri Mar 04, 2011 7:15 pm
by l3whmg
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

Re: Font in control class

Posted: Thu Mar 10, 2011 12:52 pm
by concentra
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...

Re: Font in control class

Posted: Thu Mar 10, 2011 4:36 pm
by l3whmg
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