In fact I'm just a bit worry seeing how the number of handles is increased eachCarlos, I still have some problems trying to focus on this problem. I "feel" there is something not really clear...
You want to be able to delete a HMG4 object and automatically delete the underlaying hbQt and expecially Qt objects. In every message/thread/sample I find on the web, this is NOT POSSIBLE in Qt. Memory management is done by Qt with its own rules.
time a window in open or each time the mouse is over a menu and do not decrease. Memory leak ?
So if we implement it and if Qt wants to do it is ok.The only way to ask Qt to delete the object is using the Qt::WA_DeleteOnClose. And you are just asking Qt to "please, can you delete the object when you want to do it..., really thanks...."
I know that, this code was intended (not too much) to see how release method works with parentsThat said, your sample code looks strange to me..... let me explain
I found time ago some code (HMGEE) that uses a label (in fact is a window without title. C code) as container and child objects are inside this container. Row and col a related to the container. If this is useful or not, well this is another story. QT has a different way to do the things.A) Parenting
I don't understand why you are setting the parents in this way.... are these parenting useful in a application ?
:parent has good code, for examply it correctly handles the removal from the parent both as DATA member and in ::aControls array, something :release() in the various forms doesn't do correctly.
What :parent() doesn't do is Qt parenting !!!!!
Have a look at Label:New(). Creating the QLabel we set a Qt parenting. ::parent() doesn't update this parenting.
So after the line
LBL3:Parent := LBL2
the HMG parenting is one, the Qt parenting is another one and LBL3 is still a child of the window....
You may change the code to
With Object LBL3 := label():New( "LBL3", LBL2 )
but the label won't show... a label inside a label ?!?!?!?
Thanks for the explanation.B) why qt object doesn't get deleted
C) main and child windows
D) how to close a window
When window type is WND_STANDARD it doesn't stop the eventloop....
Since WND_MAIN is the only window type run in a different way (we should check all the windows types) I changed the if in:
IF ::nType != WND_MAIN
::oEventLoop:Exit( 0 )
and now everything works, the window is closed, the msginfo shown and when oStd goes out of scope used memory (hmg/hbQt/Qt) should be correctly recovered.
Do you will commit this ?