wxTextCtrl::SetSelection(0, 1) didn't work Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
00061205
Knows some wx things
Knows some wx things
Posts: 41
Joined: Mon Jun 16, 2008 3:43 am
Location: Beijing, China

wxTextCtrl::SetSelection(0, 1) didn't work

Post by 00061205 » Wed Jul 30, 2008 6:30 am

Why SetSelection(0,1) didn't work in my app?

Code: Select all

ctrlaFrame::ctrlaFrame(wxWindow* parent,wxWindowID id)
{
   ......
    TextCtrl1 = new wxTextCtrl(this, ID_TEXTCTRL1, _("Text"), wxDefaultPosition, wxSize(268,260), wxTE_MULTILINE, wxDefaultValidator, _T("ID_TEXTCTRL1"));
    ......
    TextCtrl1->SetValue(L"a;dlfkasfd\na;slfsa;fd\naslkdfas;f");
    TextCtrl1->SetSelection(0, 1);
}
Windows XP+C::B 8.02+wxWidgets 2.8.8
By the way, in ubuntu SetSelection(0,1) works great.
Regards,

00061205

00061205
Knows some wx things
Knows some wx things
Posts: 41
Joined: Mon Jun 16, 2008 3:43 am
Location: Beijing, China

Post by 00061205 » Wed Jul 30, 2008 11:34 am

I figured it out. The wxTE_NOHIDESEL style must be set in MSW to show the selection when it doesn't have focus.
Regards,

00061205

Post Reply