AUI focus problem

Harry "harry dot news at armadillo dot fr" at a.mx.sunsite.dk
Thu Mar 20 01:16:06 PDT 2008


Hi,

An AUI problem almost drove me crazy, where a floated window absolutely 
refused to accept the focus,
no matter how many times I clicked on it.

I finally tracked the problem to the fact that a floated window is 
wrapped in a mini-frame that is itself
the child of the managed window. This configuration of a top-level 
window as a child caused the problem :

wxGetTopLevelParent() when called for the floated window from 
wxTopLevelWindowMSW::OnActivate(),
will return the mini-frame as the top window, rather than returning the 
managed window, therefore causing the logic
in wxTopLevelWindowMSW::OnActivate() to go completely wrong.

I've solved the problem in wxGetTopLevelParent() by rewriting it to look 
for the last top-level window,
rather than for the first, like this:

    wxWindow* top = NULL;
    while ( win ) {
        if ( win->IsTopLevel() )
            top = win;
        win = win->GetParent();
    }
    return top;

This corrected my problem.
However, a quick search for IsTopLevel thru the sources have shown me 
that the same conception
occurs in several other places - stopping on the first top-level window.
There might be other places in the code that require a similar correction.

Regards
Harry






More information about the wx-users mailing list