long style,
const wxPoint& pos )
{
+ long styleLbox;
+#if wxUSE_CHECKLISTBOX
+ styleLbox = wxLB_ALWAYS_SB;
+#else
+ styleLbox = wxLB_ALWAYS_SB | wxLB_EXTENDED;
+#endif
+
if ( !wxAnyChoiceDialog::Create(parent, message, caption,
n, choices,
style, pos,
- wxLB_ALWAYS_SB | wxLB_EXTENDED) )
+ styleLbox) )
return false;
return true;
void wxMultiChoiceDialog::SetSelections(const wxArrayInt& selections)
{
+#if wxUSE_CHECKLISTBOX
+ wxCheckListBox* checkListBox = wxDynamicCast(m_listbox, wxCheckListBox);
+ if (checkListBox)
+ {
+ // first clear all currently selected items
+ size_t n,
+ count = checkListBox->GetCount();
+ for ( n = 0; n < count; ++n )
+ {
+ if (checkListBox->IsChecked(n))
+ checkListBox->Check(n, false);
+ }
+
+ // now select the ones which should be selected
+ count = selections.GetCount();
+ for ( n = 0; n < count; n++ )
+ {
+ checkListBox->Check(selections[n]);
+ }
+
+ return;
+ }
+#endif
+
// first clear all currently selected items
size_t n,
count = m_listbox->GetCount();
bool wxMultiChoiceDialog::TransferDataFromWindow()
{
m_selections.Empty();
+
+#if wxUSE_CHECKLISTBOX
+ wxCheckListBox* checkListBox = wxDynamicCast(m_listbox, wxCheckListBox);
+ if (checkListBox)
+ {
+ size_t count = checkListBox->GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ if ( checkListBox->IsChecked(n) )
+ m_selections.Add(n);
+ }
+ return true;
+ }
+#endif
+
size_t count = m_listbox->GetCount();
for ( size_t n = 0; n < count; n++ )
{