Fix current field highlighting in generic wxTimePickerCtrl under wxGTK.
In wxGTK, calling HighlightCurrentField() from EVT_SET_FOCUS handler was not enough as the highlighting was overwritten by the default behaviour of selecting the entire text control contents on focus gain. Fix this by calling SetFocus() from HighlightCurrentField() before updating the selection. This ensures that the correct field is always highlighted. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69291 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -300,24 +300,16 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
ChangeCurrentField(field);
|
ChangeCurrentField(field);
|
||||||
|
|
||||||
// As we don't skip the event, we also prevent the system from setting
|
|
||||||
// focus to this control as it does by default, so do it manually.
|
|
||||||
m_text->SetFocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnArrowUp(wxSpinEvent& WXUNUSED(event))
|
void OnArrowUp(wxSpinEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
ChangeCurrentFieldBy1(Dir_Up);
|
ChangeCurrentFieldBy1(Dir_Up);
|
||||||
|
|
||||||
m_text->SetFocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnArrowDown(wxSpinEvent& WXUNUSED(event))
|
void OnArrowDown(wxSpinEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
ChangeCurrentFieldBy1(Dir_Down);
|
ChangeCurrentFieldBy1(Dir_Down);
|
||||||
|
|
||||||
m_text->SetFocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -376,6 +368,8 @@ private:
|
|||||||
// Select the currently actively field.
|
// Select the currently actively field.
|
||||||
void HighlightCurrentField()
|
void HighlightCurrentField()
|
||||||
{
|
{
|
||||||
|
m_text->SetFocus();
|
||||||
|
|
||||||
const CharRange range = GetFieldRange(m_currentField);
|
const CharRange range = GetFieldRange(m_currentField);
|
||||||
|
|
||||||
m_text->SetSelection(range.from, range.to);
|
m_text->SetSelection(range.from, range.to);
|
||||||
|
|||||||
Reference in New Issue
Block a user