Hi Luigi.
I read your post talking about forms superficially and I think you asked something and I answered another !
And please remember that I am new to HMG and never used HMG3.
Everything I wrote was about controls, nothing about forms at all...
Sorry !
And backing to the beginning of my thoughts about controls, many issues could be avoided if the controls NEW() method instantiates the correspondent QT object.
Today, the correspondent QT object is instantiated when the ACTIVATE() method of the form that contains the control is called.
Seems this is by design, probably because of HMG3 compatibility.
What I suggested was a simple way to instantiate a QT control in the NEW() method without big changes in the code and preserving the compatibility.
In a post here you noted about a problem in AUTOSIZE method of label control, and I pointed that in my opinion the problem was related to the fact that label NEW() method doesn´t instantiate a QT object.
But to instantiate a QT control object, we need to know its QT parent and the way HMG4 is coded this could not possible without a big change in the window (forms) classes and all controls, what I want to avoid.
Please, forget HB_QWith(1) this was a nonsense, my mistake in interpreting some code in my mind. And thank you, because trying to understand what you didn´t, I understood that I wasn´t understanding...
Finally I presented a suggestion to instantiate controls changing 1 line in window.prg and a few in button.prg. I used the button class button.prg only to present an example and see if others agree with it or not.
First: QFont() create an object font, but it's not inherit from parent (this is a common problem).
In the suggestion I presented this will probably still occur.
Seems to me that you've mixed HMG object and QT object.
A little. But they are very related.
form case
::oDefaultParent := HMG-form and not ::oDefaultParent := QT-form
Please forget about forms... I wasn´t talking about forms.
button case
::oParent := ::oDefaultParent
::oParent := HMG-formParent not ::oParent := QT-formParent
Ok, I understood that ::oParent is an HMG object, but the time control´s NEW() method is called, ::oParent don´t have a QT object associated and it´s not possible to instantiate a control´s QT object referencing the associated parent QT object.
In the suggestion I presented, the control class instantiates the QT object earlier, in the NEW() method, without associating it with the corresponding QT object.
The association will be made later, in the window class´s ACTIVATE() method, replacing the actual mode of instantiating controls and preserving compatibility with the actual code.
ie for button I can use
::oQtObject:setParent( ::oParent:oQtObject )
I suppose that this can be used to all controls ( don´t know about windows/forms... ).
And the button class Default() method was already wrong, I just cut and pasted. I will fix.