Next try on pop up menus. (#ifdef x11).

More SetFocus() work.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14545 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2002-03-10 20:35:55 +00:00
parent ac92c7e948
commit 9b8270da40
4 changed files with 19 additions and 4 deletions

View File

@@ -216,12 +216,13 @@ void wxPopupTransientWindow::PopHandlers()
if ( m_focus ) if ( m_focus )
{ {
#ifndef __WXX11__
if ( !m_focus->RemoveEventHandler(m_handlerFocus) ) if ( !m_focus->RemoveEventHandler(m_handlerFocus) )
{ {
// see above // see above
m_handlerFocus = NULL; m_handlerFocus = NULL;
} }
#endif
m_focus = NULL; m_focus = NULL;
} }
} }
@@ -251,6 +252,8 @@ void wxPopupTransientWindow::Popup(wxWindow *winFocus)
m_focus = winFocus ? winFocus : this; m_focus = winFocus ? winFocus : this;
m_focus->SetFocus(); m_focus->SetFocus();
#ifndef __WXX11__
#ifdef __WXMSW__ #ifdef __WXMSW__
// MSW doesn't allow to set focus to the popup window, but we need to // MSW doesn't allow to set focus to the popup window, but we need to
// subclass the window which has the focus, and not winFocus passed in or // subclass the window which has the focus, and not winFocus passed in or
@@ -264,6 +267,8 @@ void wxPopupTransientWindow::Popup(wxWindow *winFocus)
m_focus->PushEventHandler(m_handlerFocus); m_focus->PushEventHandler(m_handlerFocus);
} }
#endif
} }
void wxPopupTransientWindow::Dismiss() void wxPopupTransientWindow::Dismiss()

View File

@@ -3979,7 +3979,8 @@ bool wxWin32InputHandler::HandleMouse(wxInputConsumer *control,
{ {
wxWindow *win = control->GetInputWindow(); wxWindow *win = control->GetInputWindow();
if ( wxWindow::FindFocus() != control->GetInputWindow() ) if (( wxWindow::FindFocus() != control->GetInputWindow() ) &&
( win->AcceptsFocus() ) )
{ {
win->SetFocus(); win->SetFocus();

View File

@@ -661,7 +661,6 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
g_nextFocus = win; g_nextFocus = win;
win->SetFocus(); win->SetFocus();
// return TRUE;
} }
} }

View File

@@ -251,7 +251,17 @@ void wxWindowX11::SetFocus()
Window xwindow = (Window) GetMainWindow(); Window xwindow = (Window) GetMainWindow();
wxCHECK_RET( xwindow, wxT("invalid window") ); wxCHECK_RET( xwindow, wxT("invalid window") );
wxCHECK_RET( AcceptsFocus(), wxT("set focus on window that doesn't accept the focus") );
#if 0
if (GetName() == "scrollBar")
{
char *crash = NULL;
*crash = 0;
}
#endif
if (wxWindowIsVisible(xwindow)) if (wxWindowIsVisible(xwindow))
{ {
XSetInputFocus( wxGlobalDisplay(), xwindow, RevertToParent, CurrentTime ); XSetInputFocus( wxGlobalDisplay(), xwindow, RevertToParent, CurrentTime );