select the whole text in the single line text control when its SetFocus() is called (which also happens when the user TABs to it)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15203 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2002-04-18 23:32:41 +00:00
parent 8f4a9a1025
commit 129223d68e
2 changed files with 19 additions and 0 deletions

View File

@ -128,6 +128,7 @@ public:
// Implementation from now on // Implementation from now on
// -------------------------- // --------------------------
virtual void SetFocus();
virtual void SetWindowStyleFlag(long style); virtual void SetWindowStyleFlag(long style);
virtual void Command(wxCommandEvent& event); virtual void Command(wxCommandEvent& event);

View File

@ -1244,6 +1244,24 @@ long wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
return wxTextCtrlBase::MSWWindowProc(nMsg, wParam, lParam); return wxTextCtrlBase::MSWWindowProc(nMsg, wParam, lParam);
} }
void wxTextCtrl::SetFocus()
{
wxTextCtrlBase::SetFocus();
// to be consistent with the standard Windows behaviour we select all text
// in the single line edit controls when the user TABs to them and also, to
// be consistent with this behaviour in turn, do it whenever SetFocus() is
// called as well
if ( !HasFlag(wxTE_MULTILINE) )
{
SetSelection(-1, -1);
}
}
// ----------------------------------------------------------------------------
// text control event processing
// ----------------------------------------------------------------------------
bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
{ {
switch (param) switch (param)