Changing focus\activation between wxTopLevelWindows

Luke Hart lukeh at xara.com
Wed Sep 6 05:20:46 PDT 2006


All,

I'm working on the Xara Xtreme project (xaraxtreme.org) and have hit a 
problem with implement our keyboard focus rules. We have the concept of 
galleries which are non-modal windows (i.e. derived from 
wxTopLevelWindow), which contain a list of possible attributes. Out 
focus handling rules say that these windows should never have focus, but 
these are broken whenever they are created or when the user clicks on 
there title bar. Whilst they have focus they get all keypress (as you'd 
expect), unfortunately this means that out hotkey system doesn't work 
(e.g. the key to dismiss the gallery).

Investigating further, I have discovered that I don't get SetFocus 
message, but instead Activate message when the focus is moved to 
Galleries (certainly on GTK). Handling these messages by setting the 
focus back to out document window doesn't work (nothing happens). I 
suspect that this is because wxWindow::SetFocus doesn't allow  focus to 
be moved from the one wxTLW (or its children) to another. Is there a way 
round these issues? For example is there a function that allows our main 
frame to be re-activated in response to the Activate event?

Thanks for any help,
    Luke





More information about the wx-users mailing list