After creating a wxAuiNotebook and adding some pages to it,
trying navigate through controls with TAB key on keyboard, the "tab controls" sometimes get focus
Is there a function/propety to privent this behavour?
Preventing "tab controls" on wxAuiNotebook, from getting keyboard focus
Preventing "tab controls" on wxAuiNotebook, from getting keyboard focus
- Attachments
-
- 2.png (3.92 KiB) Viewed 981 times
-
- 1.png (3.91 KiB) Viewed 981 times
Re: Preventing "tab controls" on wxAuiNotebook, from getting keyboard focus
Hi,
Did you try catching EVT_SET_FOCUS for the panel and give the focus to the first control inside?
Don't forget to call Skip() as it is not wxCommandEvent.
Thank you.
Did you try catching EVT_SET_FOCUS for the panel and give the focus to the first control inside?
Don't forget to call Skip() as it is not wxCommandEvent.
Thank you.
Re: Preventing "tab controls" on wxAuiNotebook, from getting keyboard focus
OnMySetFocus() is never called
neither OnMySetFocus(), nor SetFocusFromKbd(), are never called.
Even if I use a mouse click on TAB controls
neither OnMySetFocus(), nor SetFocusFromKbd(), are never called.
Even if I use a mouse click on TAB controls
Code: Select all
virtual bool AcceptsFocus() const { return false; };
virtual bool AcceptsFocusFromKeyboard() const { return false;};
wxBEGIN_EVENT_TABLE(wxMyAuiNotebook, wxAuiNotebook)
EVT_COMMAND(-1, MY_EVENT_NAVIGATE, wxMyAuiNotebook::OnMyEvent_Navigate)
EVT_SET_FOCUS(wxMyAuiNotebook::OnMySetFocus)
END_EVENT_TABLE()
void wxMyAuiNotebook::OnMySetFocus(wxFocusEvent& event)
{
event.Skip(false);
wxCommandEvent event0(MY_EVENT_NAVIGATE, GetId());
wxQueueEvent(this, event0.Clone());
}
void wxMyAuiNotebook::OnMyEvent_Navigate(wxCommandEvent& event)
{
Navigate(__MOVE_TAB_FORWARD);
}
void wxMyAuiNotebook::SetFocusFromKbd()
{
wxCommandEvent event0(MY_EVENT_NAVIGATE, GetId());
wxQueueEvent(this, event0.Clone());
}
Re: Preventing "tab controls" on wxAuiNotebook, from getting keyboard focus
Hi,
Why do you catch the EVT_SET_FOCUS on the notebook and not on the page?
Also, I don't think you need evt.Skip() call. You should eat the event and just set the focus to the first control on the page.
Thank you.
Why do you catch the EVT_SET_FOCUS on the notebook and not on the page?
Also, I don't think you need evt.Skip() call. You should eat the event and just set the focus to the first control on the page.
Thank you.