DECLARE_EVENT_TABLE()
};
+// a choice which handles focus set/kill (for testing)
+class MyChoice : public wxChoice
+{
+public:
+ MyChoice(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxChoiceNameStr )
+ : wxChoice(parent, id, pos, size, n, choices,
+ style, validator, name) { }
+
+protected:
+ void OnFocusGot(wxFocusEvent& event)
+ {
+ wxLogMessage(_T("MyChoice::OnFocusGot"));
+
+ event.Skip();
+ }
+
+ void OnFocusLost(wxFocusEvent& event)
+ {
+ wxLogMessage(_T("MyChoice::OnFocusLost"));
+
+ event.Skip();
+ }
+
+private:
+ DECLARE_EVENT_TABLE()
+};
+
+
+
//----------------------------------------------------------------------
// other
//----------------------------------------------------------------------
enum
{
- CONTROLS_QUIT = 100,
- CONTROLS_TEXT,
- CONTROLS_ABOUT,
+ CONTROLS_QUIT = wxID_EXIT,
+ CONTROLS_ABOUT = wxID_ABOUT,
+ CONTROLS_TEXT = 100,
CONTROLS_CLEAR_LOG,
// tooltip menu
EVT_KILL_FOCUS(MyRadioBox::OnFocusLost)
END_EVENT_TABLE()
+BEGIN_EVENT_TABLE(MyChoice, wxChoice)
+ EVT_SET_FOCUS(MyChoice::OnFocusGot)
+ EVT_KILL_FOCUS(MyChoice::OnFocusLost)
+END_EVENT_TABLE()
+
// ============================================================================
// implementation
// ============================================================================
#if wxUSE_CHOICE
panel = new wxPanel(m_book);
- m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,wxDefaultCoord), 5, choices );
- m_choiceSorted = new wxChoice( panel, ID_CHOICE_SORTED, wxPoint(10,70), wxSize(120,wxDefaultCoord),
+ m_choice = new MyChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,wxDefaultCoord), 5, choices );
+ m_choiceSorted = new MyChoice( panel, ID_CHOICE_SORTED, wxPoint(10,70), wxSize(120,wxDefaultCoord),
5, choices, wxCB_SORT );
SetChoiceClientData(wxT("choice"), m_choice);
m_text->AppendText(value);
}
-void MyPanel::OnNewText( wxCommandEvent &event )
+void MyPanel::OnNewText( wxCommandEvent& /* event */)
{
m_nonWrappingText->SetLabel( wxT("This text is short\nbut still spans\nover three lines.") );
m_wrappingText->SetLabel( wxT("This text is short but will still be wrapped if it is too long.") );