]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/controls/controls.cpp
more wxFD_XXX renamings (patch 1488371)
[wxWidgets.git] / samples / controls / controls.cpp
index 178f334240aaa26b8dd8037d89373dfbe08fd73e..999b4aa3f77ef2f256e708e39d576944a751d590 100644 (file)
@@ -787,7 +787,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
     m_combo = new MyComboBox( panel, ID_COMBO, _T("This"),
                               wxPoint(20,25), wxSize(120, wxDefaultCoord),
                               5, choices,
-                              wxPROCESS_ENTER);
+                              wxTE_PROCESS_ENTER);
 
     (void)new wxButton( panel, ID_COMBO_SEL_NUM, _T("Select #&2"), wxPoint(180,30), wxSize(140,30) );
     (void)new wxButton( panel, ID_COMBO_SEL_STR, _T("&Select 'This'"), wxPoint(340,30), wxSize(140,30) );
@@ -808,12 +808,21 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
     };
 
     panel = new wxPanel(m_book);
-    (void)new MyRadioBox( panel, ID_RADIOBOX, _T("&That"), wxPoint(10,160), wxDefaultSize, WXSIZEOF(choices2), choices2, 1, wxRA_SPECIFY_ROWS );
+    wxRadioBox *radio2 = new MyRadioBox( panel, ID_RADIOBOX, _T("&That"), wxPoint(10,160), wxDefaultSize, WXSIZEOF(choices2), choices2, 1, wxRA_SPECIFY_ROWS );
     m_radio = new wxRadioBox( panel, ID_RADIOBOX, _T("T&his"), wxPoint(10,10), wxDefaultSize, WXSIZEOF(choices), choices, 1, wxRA_SPECIFY_COLS );
 
 #if wxUSE_TOOLTIPS
     m_combo->SetToolTip(_T("This is a natural\ncombobox - can you believe me?"));
-    m_radio->SetToolTip(_T("Ever seen a radiobox?"));
+    radio2->SetToolTip(_T("Ever seen a radiobox?"));
+
+    //m_radio->SetToolTip(_T("Tooltip for the entire radiobox"));
+    for ( unsigned int nb = 0; nb < WXSIZEOF(choices); nb++ )
+    {
+        m_radio->SetItemToolTip(nb, _T("tooltip for\n") + choices[nb]);
+    }
+
+    // remove the tooltip for one of the items
+    m_radio->SetItemToolTip(2, _T(""));
 #endif // wxUSE_TOOLTIPS
 
     (void)new wxButton( panel, ID_RADIOBOX_SEL_NUM, _T("Select #&2"), wxPoint(180,30), wxSize(140,30) );
@@ -1047,6 +1056,13 @@ void MyPanel::OnIdle(wxIdleEvent& event)
     static const int INVALID_SELECTION = -2;
 
     static int s_selCombo = INVALID_SELECTION;
+
+    if (!m_combo || !m_choice)
+    {
+        event.Skip();
+        return;
+    }
+
     int sel = m_combo->GetSelection();
     if ( sel != s_selCombo )
     {
@@ -1349,6 +1365,9 @@ void MyPanel::OnChoiceButtons( wxCommandEvent &event )
 
 void MyPanel::OnCombo( wxCommandEvent &event )
 {
+    if (!m_combo)
+        return;
+    
     wxLogMessage(_T("EVT_COMBOBOX: item %d/%d (event/control), string \"%s\"/\"%s\""),
                  (int)event.GetInt(),
                  m_combo->GetSelection(),
@@ -1498,7 +1517,7 @@ void MyPanel::OnSpinCtrl(wxSpinEvent& event)
     if ( m_spinctrl )
     {
         wxString s;
-        s.Printf( _T("Spin ctrl changed: now %d (from event: %ld)\n"),
+        s.Printf( _T("Spin ctrl changed: now %d (from event: %d)\n"),
                  m_spinctrl->GetValue(), event.GetInt() );
         m_text->AppendText(s);
     }
@@ -1509,7 +1528,7 @@ void MyPanel::OnSpinCtrlUp(wxSpinEvent& event)
     if ( m_spinctrl )
     {
         m_text->AppendText( wxString::Format(
-            _T("Spin up: %d (from event: %ld)\n"),
+            _T("Spin up: %d (from event: %d)\n"),
             m_spinctrl->GetValue(), event.GetInt() ) );
     }
 }
@@ -1519,7 +1538,7 @@ void MyPanel::OnSpinCtrlDown(wxSpinEvent& event)
     if ( m_spinctrl )
     {
         m_text->AppendText( wxString::Format(
-            _T("Spin down: %d (from event: %ld)\n"),
+            _T("Spin down: %d (from event: %d)\n"),
             m_spinctrl->GetValue(), event.GetInt() ) );
     }
 }