> I was just doing some work where I wanted to get access to the tag:
>
>
> me.parent.parent
>
>  and found that though, at the start of loading the form that it exists
> (obviously) but that as soon as Form_close() is called that whearas the
> object me still exists until the form actually is destroyed, that 
> me.parent  = null. (hence no parent.parent)
>
> Can anyone explain the closing sequence, and can one get to the bit of data
> I want, from within form_close but before thet data is destroyed?
>
> Regards
>
> Richard
>

On real top-level windows, the Close event is raised when you call the Close 
method or when you click on the window manager close button. The window fully 
exists at the moment.

On embedded top-level windows, the Close event is called when the window is 
destroyed. Then you may have problems, as there is no way to know precisely 
when it happens - It depends on the toolkit. The window still exists, but its 
children or parents may not, depending on what indirectly is responsible of 
the closing.

I have just fixed a bug in Gambas 3 that made things crash in that last case. 
I'm not sure for Gambas 2, and I'm not sure everything is safe in Gambas 3 
now.

The reason is the following: Qt destroys the children of a parent widget (a 
container) *before* Gambas can see it. And the Close event of embedded windows 
is called when they are destroyed. So there is a moment when the situation is 
not coherent: Gambas think the widget exists whereas it does not. That can 
lead to crashes...

Regards,

-- 
Benoît

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to