SetSelection() in wxNotebook now sets the focus,
SPACE in wxListCtrl now sends Activate in multiple sel mode git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6212 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
efbb7287e6
commit
33d0e17c11
@ -62,9 +62,17 @@ void MyApp::InitTabView(wxNotebook* notebook, wxPanel* window)
|
||||
m_okButton = new wxButton(window, wxID_OK, "Close", wxPoint(-1, -1), wxSize(80, 25));
|
||||
m_cancelButton = new wxButton(window, ID_DELETE_PAGE, "Delete page", wxPoint(-1, -1), wxSize(80, 25));
|
||||
m_addPageButton = new wxButton(window, ID_ADD_PAGE, "Add page", wxPoint(-1, -1), wxSize(80, 25));
|
||||
m_nextPageButton = new wxButton(window, ID_NEXT_PAGE, "Next page", wxPoint(-1, -1), wxSize(80, 25));
|
||||
m_okButton->SetDefault();
|
||||
|
||||
wxLayoutConstraints* c = new wxLayoutConstraints;
|
||||
c->right.SameAs(m_addPageButton, wxLeft, 4);
|
||||
c->bottom.SameAs(window, wxBottom, 4);
|
||||
c->height.AsIs();
|
||||
c->width.AsIs();
|
||||
m_nextPageButton->SetConstraints(c);
|
||||
|
||||
c = new wxLayoutConstraints;
|
||||
c->right.SameAs(window, wxRight, 4);
|
||||
c->bottom.SameAs(window, wxBottom, 4);
|
||||
c->height.AsIs();
|
||||
@ -189,6 +197,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_BUTTON(wxID_OK, MyFrame::OnOK)
|
||||
EVT_BUTTON(ID_DELETE_PAGE, MyFrame::OnDeletePage)
|
||||
EVT_BUTTON(ID_ADD_PAGE, MyFrame::OnAddPage)
|
||||
EVT_BUTTON(ID_NEXT_PAGE, MyFrame::OnNextPage)
|
||||
EVT_IDLE(MyFrame::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
@ -214,6 +223,11 @@ void MyFrame::OnDeletePage(wxCommandEvent& WXUNUSED(event))
|
||||
m_notebook->DeletePage( m_notebook->GetPageCount()-1 );
|
||||
}
|
||||
|
||||
void MyFrame::OnNextPage(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_notebook->AdvanceSelection();
|
||||
}
|
||||
|
||||
void MyFrame::OnOK(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
Destroy();
|
||||
|
@ -21,6 +21,7 @@ public:
|
||||
wxButton* m_okButton;
|
||||
wxButton* m_cancelButton;
|
||||
wxButton* m_addPageButton;
|
||||
wxButton* m_nextPageButton;
|
||||
};
|
||||
|
||||
DECLARE_APP(MyApp)
|
||||
@ -54,6 +55,7 @@ public:
|
||||
void OnOK(wxCommandEvent& event);
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
void OnAddPage(wxCommandEvent& event);
|
||||
void OnNextPage(wxCommandEvent& event);
|
||||
void OnDeletePage(wxCommandEvent& event);
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
|
||||
@ -88,4 +90,5 @@ protected:
|
||||
#define ID_NOTEBOOK 1000
|
||||
#define ID_ADD_PAGE 1200
|
||||
#define ID_DELETE_PAGE 1201
|
||||
#define ID_NEXT_PAGE 1202
|
||||
|
||||
|
@ -2077,8 +2077,19 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
|
||||
}
|
||||
case WXK_SPACE:
|
||||
{
|
||||
m_current->ReverseHilight();
|
||||
RefreshLine( m_current );
|
||||
if (m_mode & wxLC_SINGLE_SEL)
|
||||
{
|
||||
wxListEvent le( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, GetParent()->GetId() );
|
||||
le.SetEventObject( GetParent() );
|
||||
le.m_itemIndex = GetIndexOfLine( m_current );
|
||||
m_current->GetItem( 0, le.m_item );
|
||||
GetParent()->GetEventHandler()->ProcessEvent( le );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_current->ReverseHilight();
|
||||
RefreshLine( m_current );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WXK_INSERT:
|
||||
|
@ -357,6 +357,10 @@ int wxNotebook::SetSelection( int page )
|
||||
int selOld = GetSelection();
|
||||
|
||||
gtk_notebook_set_page( GTK_NOTEBOOK(m_widget), page );
|
||||
|
||||
wxGtkNotebookPage* g_page = GetNotebookPage( page );
|
||||
if (g_page->m_client)
|
||||
g_page->m_client->SetFocus();
|
||||
|
||||
return selOld;
|
||||
}
|
||||
|
@ -357,6 +357,10 @@ int wxNotebook::SetSelection( int page )
|
||||
int selOld = GetSelection();
|
||||
|
||||
gtk_notebook_set_page( GTK_NOTEBOOK(m_widget), page );
|
||||
|
||||
wxGtkNotebookPage* g_page = GetNotebookPage( page );
|
||||
if (g_page->m_client)
|
||||
g_page->m_client->SetFocus();
|
||||
|
||||
return selOld;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user