wxCocoa only: Give the buddy text control focus if the user changes the spinner.
Copyright 2007 Software 2000 Ltd. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@50335 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -319,6 +319,22 @@ void wxSpinCtrl::SetTextValue(int val)
|
|||||||
|
|
||||||
// and give focus to the control!
|
// and give focus to the control!
|
||||||
// m_text->SetFocus(); Why???? TODO.
|
// m_text->SetFocus(); Why???? TODO.
|
||||||
|
|
||||||
|
#ifdef __WXCOCOA__
|
||||||
|
/* It's sort of a hack to do this from here but the idea is that if the
|
||||||
|
user has clicked on us, which is the main reason this method is called,
|
||||||
|
then focus probably ought to go to the text control since clicking on
|
||||||
|
a text control usually gives it focus.
|
||||||
|
|
||||||
|
However, if the focus is already on us (i.e. the user has turned on
|
||||||
|
the ability to tab to controls) then we don't want to drop focus.
|
||||||
|
So we only set focus if we would steal it away from a different
|
||||||
|
control, not if we would steal it away from ourself.
|
||||||
|
*/
|
||||||
|
wxWindow *currentFocusedWindow = wxWindow::FindFocus();
|
||||||
|
if(currentFocusedWindow != this && currentFocusedWindow != m_text)
|
||||||
|
m_text->SetFocus();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSpinCtrl::SetValue(int val)
|
void wxSpinCtrl::SetValue(int val)
|
||||||
|
Reference in New Issue
Block a user