};
wxArrayInt selections;
- size_t count = wxGetMultipleChoices(selections,
+ const int count = wxGetSelectedChoices(selections,
_T("This is a small sample\n")
_T("A multi-choice convenience dialog"),
_T("Please select a value"),
WXSIZEOF(choices), choices,
this);
- if ( count )
+ if ( count >= 0 )
{
wxString msg;
- msg.Printf(wxT("You selected %u items:\n"), (unsigned)count);
- for ( size_t n = 0; n < count; n++ )
+ if ( count == 0 )
{
- msg += wxString::Format(wxT("\t%u: %u (%s)\n"),
- (unsigned)n, (unsigned)selections[n],
- choices[selections[n]].c_str());
+ msg = wxT("You did not select any items");
+ }
+ else
+ {
+ msg.Printf(wxT("You selected %u items:\n"), (unsigned)count);
+ for ( int n = 0; n < count; n++ )
+ {
+ msg += wxString::Format(wxT("\t%u: %u (%s)\n"),
+ (unsigned)n, (unsigned)selections[n],
+ choices[selections[n]].c_str());
+ }
}
wxLogMessage(msg);
}
- //else: cancelled or nothing selected
+ //else: cancelled
}
#endif // wxUSE_CHOICEDLG
wxTextCtrl *m_text;
DECLARE_EVENT_TABLE()
- DECLARE_NO_COPY_CLASS(MyRearrangeDialog)
+ wxDECLARE_NO_COPY_CLASS(MyRearrangeDialog);
};
BEGIN_EVENT_TABLE(MyRearrangeDialog, wxRearrangeDialog)
void MyFrame::OnNotifMsgHide(wxCommandEvent& WXUNUSED(event))
{
- if ( m_notifMsg )
+ if ( m_notifMsg && !m_notifMsg->Close() )
{
- if ( !m_notifMsg->Close() )
- wxLogStatus("Failed to hide manual notification message");
+ wxLogStatus("Failed to hide manual notification message");
}
}
wxAboutDialogInfo info;
InitAboutInfoMinimal(info);
- wxAboutBox(info);
+ wxAboutBox(info, this);
}
void MyFrame::ShowFancyAboutDialog(wxCommandEvent& WXUNUSED(event))
wxAboutDialogInfo info;
InitAboutInfoWebsite(info);
- wxAboutBox(info);
+ wxAboutBox(info, this);
}
void MyFrame::ShowFullAboutDialog(wxCommandEvent& WXUNUSED(event))
wxAboutDialogInfo info;
InitAboutInfoAll(info);
- wxAboutBox(info);
+ wxAboutBox(info, this);
}
// a trivial example of a custom dialog class
class MyAboutDialog : public wxGenericAboutDialog
{
public:
- MyAboutDialog(const wxAboutDialogInfo& info)
+ MyAboutDialog(const wxAboutDialogInfo& info, wxWindow* parent)
{
- Create(info);
+ Create(info, parent);
}
// add some custom controls
wxAboutDialogInfo info;
InitAboutInfoAll(info);
- MyAboutDialog dlg(info);
+ MyAboutDialog dlg(info, this);
dlg.ShowModal();
}
for ( int i = 0; i < 18; i++ )
{
- //wxUsleep(100);
+ wxMilliSleep(100);
wxTheApp->Yield();
}
m_btnModeless = new wxButton(this, wxID_ANY, _T("Mode&less dialog"));
m_btnDelete = new wxButton(this, wxID_ANY, _T("&Delete button"));
- wxButton *btnOk = new wxButton(this, wxID_CANCEL, _T("&Close"));
sizerTop->Add(m_btnModal, 0, wxALIGN_CENTER | wxALL, 5);
sizerTop->Add(m_btnModeless, 0, wxALIGN_CENTER | wxALL, 5);
sizerTop->Add(m_btnDelete, 0, wxALIGN_CENTER | wxALL, 5);
- sizerTop->Add(btnOk, 0, wxALIGN_CENTER | wxALL, 5);
+ sizerTop->Add(new wxButton(this, wxID_CLOSE), 0, wxALIGN_CENTER | wxALL, 5);
SetSizerAndFit(sizerTop);
+ SetEscapeId(wxID_CLOSE);
+
m_btnModal->SetFocus();
m_btnModal->SetDefault();
}
// icon choice
const wxString icons[] = {
- "&Information", "&Question", "&Warning", "&Error"
+ "&None", "&Information", "&Question", "&Warning", "&Error"
};
- m_icons = new wxRadioBox(this, wxID_ANY, "&Icon:",
+ m_icons = new wxRadioBox(this, wxID_ANY, "&Icons",
wxDefaultPosition, wxDefaultSize,
WXSIZEOF(icons), icons);
+ // Make the 'Information' icon the default one:
+ m_icons->SetSelection(1);
sizerTop->Add(m_icons, wxSizerFlags().Expand().Border());
switch ( m_icons->GetSelection() )
{
- case 0: style |= wxICON_INFORMATION; break;
- case 1: style |= wxICON_QUESTION; break;
- case 2: style |= wxICON_WARNING; break;
- case 3: style |= wxICON_ERROR; break;
+ case 0: style |= wxICON_NONE; break;
+ case 1: style |= wxICON_INFORMATION; break;
+ case 2: style |= wxICON_QUESTION; break;
+ case 3: style |= wxICON_WARNING; break;
+ case 4: style |= wxICON_ERROR; break;
}
if ( m_chkCentre->IsChecked() )