How to let the wxTextCtrl can select all by "ctrl+a&quo Topic is solved
How to let the wxTextCtrl can select all by "ctrl+a&quo
How let wxTextCtrl can select all by "ctrl+a"
Last edited by 00061205 on Thu Jul 31, 2008 5:02 am, edited 1 time in total.
Regards,
00061205
00061205
Check out wxKeyEvent:
http://docs.wxwidgets.org/stable/wx_wxk ... wxkeyevent
then handle the event by checking to see if event.CmdDown + "a" keyCode was pressed, then call wxTextCtrl::SetSelection(0, LastCharPos);
http://docs.wxwidgets.org/stable/wx_wxk ... wxkeyevent
then handle the event by checking to see if event.CmdDown + "a" keyCode was pressed, then call wxTextCtrl::SetSelection(0, LastCharPos);
Thanks, I'll try.SteveDowd wrote:Check out wxKeyEvent:
http://docs.wxwidgets.org/stable/wx_wxk ... wxkeyevent
then handle the event by checking to see if event.CmdDown + "a" keyCode was pressed, then call wxTextCtrl::SetSelection(0, LastCharPos);
Regards,
00061205
00061205
I solved this problem by connect the keyevent to wxTextCtrl control.
Code: Select all
Step 1
TextCtrl1->Connect(ID_TEXTCTRL1,wxEVT_CHAR,(wxObjectEventFunction)&ctrlaFrame::OnChar,NULL,this);
Step 2
void ctrlaFrame::OnChar(wxKeyEvent& event)
{ //The keycode of "ctrl+a" is 1
if(event.GetKeyCode()==1)
TextCtrl1->SetSelection(-1,-1); //selecte all
event.Skip();
}
Regards,
00061205
00061205
Re: How to let the wxTextCtrl can select all by "ctrl+a&quo
Thanks,
My suggestion:
My suggestion:
Code: Select all
if (wxGetKeyState(wxKeyCode('A')) && wxGetKeyState(WXK_CONTROL))
tcSourceTxtCtrl_->SetSelection(-1, -1); //select all
event.Skip();
M$, VS2017, C++