void OnEnableAll(wxCommandEvent& event);
void OnChangeColour(wxCommandEvent& event);
void OnTestButton(wxCommandEvent& event);
+ void OnBmpButton(wxCommandEvent& event);
wxListBox *m_listbox,
*m_listboxSorted;
frame->SetMenuBar(menu_bar);
frame->Show(TRUE);
- frame->SetCursor(wxCursor(wxCURSOR_HAND));
- frame->GetPanel()->m_notebook->SetSelection(6);
+ //frame->GetPanel()->m_notebook->SetSelection(6);
SetTopWindow(frame);
const int ID_BUTTON_TEST1 = 190;
const int ID_BUTTON_TEST2 = 191;
+const int ID_BITMAP_BTN = 192;
const int ID_CHANGE_COLOUR = 200;
EVT_CHECKBOX (ID_CHANGE_COLOUR, MyPanel::OnChangeColour)
EVT_BUTTON (ID_BUTTON_TEST1, MyPanel::OnTestButton)
EVT_BUTTON (ID_BUTTON_TEST2, MyPanel::OnTestButton)
+EVT_BUTTON (ID_BITMAP_BTN, MyPanel::OnBmpButton)
END_EVENT_TABLE()
MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
wxPoint(0, 250), wxSize(100, 50), wxTE_MULTILINE);
m_text->SetBackgroundColour("wheat");
- wxLog::AddTraceMask(_T("focus"));
+ if ( 0 )
+ wxLog::AddTraceMask(_T("focus"));
m_logTargetOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_text));
m_notebook = new wxNotebook(this, ID_NOTEBOOK);
#endif // wxUSE_TOOLTIPS
(void)new wxCheckBox( panel, ID_CHANGE_COLOUR, "&Toggle colour",
wxPoint(110,170) );
+ panel->SetCursor(wxCursor(wxCURSOR_HAND));
m_notebook->AddPage(panel, "wxListBox", TRUE, Image_List);
panel = new wxPanel(m_notebook);
panel = new wxPanel(m_notebook);
-#ifndef __WXMOTIF__ // wxStaticBitmap not working under Motif yet. MB
+#if !defined(__WXMOTIF__) && !defined(__WIN16__) // wxStaticBitmap not working under Motif yet; and icons not allowed under WIN16.
wxIcon icon = wxTheApp->GetStdIcon(wxICON_INFORMATION);
wxStaticBitmap *bmpStatic = new wxStaticBitmap(panel, -1, icon,
wxPoint(10, 10));
dc.DrawText("Bitmap", 30, 40);
dc.SelectObject( wxNullBitmap );
- (void)new wxBitmapButton(panel, -1, bitmap, wxPoint(100, 20));
+ (void)new wxBitmapButton(panel, ID_BITMAP_BTN, bitmap, wxPoint(100, 20));
-#if 1
+#ifdef __WXMSW__
// test for masked bitmap display
bitmap = wxBitmap("test2.bmp", wxBITMAP_TYPE_BMP);
- bitmap.SetMask(new wxMask(bitmap, *wxBLUE));
- (void)new wxStaticBitmap /* wxBitmapButton */ (panel, -1, bitmap, wxPoint(300, 120));
+ if (bitmap.Ok())
+ {
+ bitmap.SetMask(new wxMask(bitmap, *wxBLUE));
+
+ (void)new wxStaticBitmap /* wxBitmapButton */ (panel, -1, bitmap, wxPoint(300, 120));
+ }
#endif
wxBitmap bmp1(wxTheApp->GetStdIcon(wxICON_INFORMATION)),
event.GetId() == ID_BUTTON_TEST1 ? _T('1') : _T('2'));
}
+void MyPanel::OnBmpButton(wxCommandEvent& event)
+{
+ wxLogMessage(_T("Bitmap button clicked."));
+}
+
void MyPanel::OnChangeColour(wxCommandEvent& WXUNUSED(event))
{
static wxColour s_colOld;
m_lbSelectThis->Enable( event.GetInt() == 0 );
m_lbSelectNum->Enable( event.GetInt() == 0 );
m_listboxSorted->Enable( event.GetInt() == 0 );
+ FindWindow(ID_CHANGE_COLOUR)->Enable( event.GetInt() == 0 );
break;
}
case ID_LISTBOX_SEL_NUM:
max, // range
this, // parent
wxPD_CAN_ABORT |
+ wxPD_AUTO_HIDE |
wxPD_APP_MODAL |
wxPD_ELAPSED_TIME |
wxPD_ESTIMATED_TIME |
bool cont = TRUE;
- for ( int i = 0; i < max && cont; i++ )
+ for ( int i = 0; i <= max && cont; i++ )
{
wxSleep(1);
- if ( i == max - 1 )
+ if ( i == max )
{
cont = dialog.Update(i, "That's all, folks!");
}
else if ( i == max / 2 )
{
- cont = dialog.Update(i, "Only a half left!");
+ cont = dialog.Update(i, "Only a half left (very long message)!");
}
else
{
void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) )
{
- wxBeginBusyCursor();
+ wxBusyCursor bc;
wxMessageDialog dialog(this, "This is a control sample", "About Controls", wxOK );
dialog.ShowModal();
-
- wxEndBusyCursor();
}
void MyFrame::OnClearLog(wxCommandEvent& WXUNUSED(event))