#if wxUSE_SPINCTRL
void OnSpinCtrl(wxSpinEvent& event);
+ void OnSpinCtrlUp(wxSpinEvent& event);
+ void OnSpinCtrlDown(wxSpinEvent& event);
+ void OnSpinCtrlText(wxCommandEvent& event);
#endif // wxUSE_SPINCTRL
void OnEnableAll(wxCommandEvent& event);
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxRadioBoxNameStr)
: wxRadioBox(parent, id, title, pos, size, n, choices, majorDim,
- style, validator, name) { }
+ style, validator, name) { SetForegroundColour(*wxRED); }
protected:
void OnFocusGot(wxFocusEvent& event)
#endif // wxUSE_SPINBTN
#if wxUSE_SPINCTRL
EVT_SPINCTRL (ID_SPINCTRL, MyPanel::OnSpinCtrl)
+EVT_SPIN_UP (ID_SPINCTRL, MyPanel::OnSpinCtrlUp)
+EVT_SPIN_DOWN (ID_SPINCTRL, MyPanel::OnSpinCtrlDown)
+EVT_TEXT (ID_SPINCTRL, MyPanel::OnSpinCtrlText)
#endif // wxUSE_SPINCTRL
#if wxUSE_TOGGLEBTN
EVT_TOGGLEBUTTON(ID_BUTTON_LABEL, MyPanel::OnUpdateLabel)
// ============================================================================
MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
- : wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) ),
- m_text(NULL), m_notebook(NULL)
+ : wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) )
{
+ m_listbox = NULL;
+ m_listboxSorted = NULL;
+#if wxUSE_CHOICE
+ m_choice = NULL;
+ m_choiceSorted = NULL;
+#endif
+ m_combo = NULL;
+ m_radio = NULL;
+ m_gauge = NULL;
+ m_gaugeVert = NULL;
+ m_slider = NULL;
+ m_fontButton = NULL;
+ m_lbSelectNum = NULL;
+ m_lbSelectThis = NULL;
+#if wxUSE_SPINBTN
+ m_spinbutton = NULL;
+ m_btnProgress = NULL;
+#endif // wxUSE_SPINBTN
+#if wxUSE_SPINCTRL
+ m_spinctrl = NULL;
+#endif // wxUSE_SPINCTRL
+ m_spintext = NULL;
+ m_checkbox = NULL;
+ m_text = NULL;
+ m_notebook = NULL;
+ m_label = NULL;
+
m_text = new wxTextCtrl(this, -1, "This is the log window.\n",
wxPoint(0, 250), wxSize(100, 50), wxTE_MULTILINE);
m_text->SetBackgroundColour(wxT("wheat"));
panel = new wxPanel(m_notebook);
(void)new MyRadioBox( panel, ID_RADIOBOX, "&That", wxPoint(10,160), wxSize(-1,-1), WXSIZEOF(choices2), choices2, 1, wxRA_SPECIFY_ROWS );
m_radio = new wxRadioBox( panel, ID_RADIOBOX, "T&his", wxPoint(10,10), wxSize(-1,-1), WXSIZEOF(choices), choices, 1, wxRA_SPECIFY_COLS );
+ m_radio->SetForegroundColour(*wxRED);
#if wxUSE_TOOLTIPS
m_combo->SetToolTip("This is a natural\ncombobox - can you believe me?");
m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,-1),
wxSL_AUTOTICKS | wxSL_LABELS );
m_slider->SetTickFreq(40, 0);
+#if wxUSE_TOOLTIPS
+ m_slider->SetToolTip(_T("This is a sliding slider"));
+#endif // wxUSE_TOOLTIPS
+
(void)new wxStaticBox( panel, -1, "&Explanation",
wxPoint(230,10), wxSize(270,130),
wxALIGN_CENTER );
#if !defined(__WXMOTIF__) && !defined(__WIN16__) // wxStaticBitmap not working under Motif yet; and icons not allowed under WIN16.
wxIcon icon = wxArtProvider::GetIcon(wxART_INFORMATION);
- wxStaticBitmap *bmpStatic = new wxStaticBitmap(panel, -1, icon,
- wxPoint(10, 10));
+ (void) new wxStaticBitmap( panel, -1, icon, wxPoint(10, 10) );
- bmpStatic = new wxStaticBitmap(panel, -1, wxNullIcon, wxPoint(50, 10));
- bmpStatic->SetIcon(wxArtProvider::GetIcon(wxART_QUESTION));
+ // VZ: don't leak memory
+ // bmpStatic = new wxStaticBitmap(panel, -1, wxNullIcon, wxPoint(50, 10));
+ // bmpStatic->SetIcon(wxArtProvider::GetIcon(wxART_QUESTION));
#endif // !Motif
wxBitmap bitmap( 100, 100 );
m_text->AppendText( "\n" );
}
-void MyPanel::OnComboTextChanged(wxCommandEvent& WXUNUSED(event))
+void MyPanel::OnComboTextChanged(wxCommandEvent& event)
{
- wxLogMessage(_T("Text in the combobox changed: now is '%s'."),
- m_combo->GetValue().c_str());
+ wxString str;
+ str.Printf( wxT("Text in the combobox changed: now is '%s'."),
+ event.GetString().c_str() );
+ wxLogMessage( str.c_str() );
}
void MyPanel::OnComboTextEnter(wxCommandEvent& WXUNUSED(event))
}
case ID_RADIOBOX_FONT:
{
+ m_radio->SetForegroundColour(*wxGREEN);
+
m_radio->SetFont( *wxITALIC_FONT );
break;
}
#if wxUSE_SPINCTRL
+void MyPanel::OnSpinCtrlText(wxCommandEvent& event)
+{
+ if ( m_spinctrl )
+ {
+ wxString s;
+ s.Printf( _T("Spin ctrl text changed: now %d (from event: %s)\n"),
+ m_spinctrl->GetValue(), event.GetString().c_str() );
+ m_text->AppendText(s);
+ }
+}
+
void MyPanel::OnSpinCtrl(wxSpinEvent& event)
{
- wxString s;
- s.Printf(_T("Spin ctrl changed: now %d (from event: %d)\n"),
- m_spinctrl->GetValue(), event.GetInt());
- m_text->AppendText(s);
+ if ( m_spinctrl )
+ {
+ wxString s;
+ s.Printf( _T("Spin ctrl changed: now %d (from event: %ld)\n"),
+ m_spinctrl->GetValue(), event.GetInt() );
+ m_text->AppendText(s);
+ }
+}
+
+void MyPanel::OnSpinCtrlUp(wxSpinEvent& event)
+{
+ if ( m_spinctrl )
+ {
+ m_text->AppendText( wxString::Format(
+ _T("Spin up: %d (from event: %ld)\n"),
+ m_spinctrl->GetValue(), event.GetInt() ) );
+ }
+}
+
+void MyPanel::OnSpinCtrlDown(wxSpinEvent& event)
+{
+ if ( m_spinctrl )
+ {
+ m_text->AppendText( wxString::Format(
+ _T("Spin down: %d (from event: %ld)\n"),
+ m_spinctrl->GetValue(), event.GetInt() ) );
+ }
}
#endif // wxUSE_SPINCTRL
#endif
s_windowFocus->GetClassInfo()->GetClassName()
#ifdef __WXMSW__
- , s_windowFocus->GetHWND()
+ , (unsigned int) s_windowFocus->GetHWND()
#endif
);