Don't try to set focus outside of popup window in wxMSW
This will just hide the window immediately, so prefer to ignore the "focus" argument of Popup() but show the popup instead. Update the documentation to mention that setting focus outside of popup is not supported under all platforms.
This commit is contained in:
@@ -84,10 +84,10 @@ public:
|
||||
/**
|
||||
Popup the window (this will show it too).
|
||||
|
||||
If @a winFocus is non-@NULL, it will be kept focused while this window
|
||||
is shown, otherwise this window itself will receive focus. In any case,
|
||||
the popup will disappear automatically if it loses focus because of a
|
||||
user action.
|
||||
If @a focus is non-@NULL, it will be kept focused while this window
|
||||
is shown if supported by the current platform, otherwise the popup
|
||||
itself will receive focus. In any case, the popup will disappear
|
||||
automatically if it loses focus because of a user action.
|
||||
|
||||
@see Dismiss()
|
||||
*/
|
||||
|
@@ -96,7 +96,10 @@ void wxPopupTransientWindow::Popup(wxWindow* focus)
|
||||
{
|
||||
Show();
|
||||
|
||||
if ( focus )
|
||||
// We can only set focus to one of our children as setting it to another
|
||||
// window would result in an immediate loss of activation and popup
|
||||
// disappearance.
|
||||
if ( focus && IsDescendant(focus) )
|
||||
focus->SetFocus();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user