AUI focus problem

Harry "harry dot news at armadillo dot fr" at a.mx.sunsite.dk
Thu Mar 20 03:33:47 PDT 2008



Try passing the focus to another application via alt-tab, then passing 
it the same way
back to the floating window.

If the problem still doesn't happen, it might be that in your case the 
floating pane is the first child and does get the focus.
In my case it just happened to be the second child and so never got the 
focus.
wxSetFocusToChild() will set the focus "to the first child who wants it" 
which is determined by
AcceptsFocusFromKeyboard() which is defined as AcceptsFocus() which  
sets the focus to
the first enabled & shown child, which in most cases means to the first 
child.

Riccardo Cohen wrote:
> strange, because with wx2.9 at least, I have no focus problem with 
> floating panes, I can input text and type return in it.
>
> Harry wrote:
>>
>> 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