else if ( choice->HasClientUntypedData() )
event.SetClientData( choice->GetClientData(n) );
- choice->GetEventHandler()->ProcessEvent(event);
+ choice->HandleWindowEvent(event);
}
}
PostCreation(size);
SetInitialSize(size); // need this too because this is a wxControlWithItems
+ // workaround for bug in gtk_option_menu_set_history(), it causes
+ // gtk_widget_size_allocate() to be called with the current
+ // widget->allocation values, which will be zero if a proper
+ // size_allocate has not occured yet
+ m_widget->allocation.width = m_width;
+ m_widget->allocation.height = m_height;
+
return true;
}
wxArrayString items;
wxArrayPtrVoid itemsData;
- items.Alloc(count);
- itemsData.Alloc(count);
+ items.Alloc(count - 1);
+ itemsData.Alloc(count - 1);
for ( unsigned i = 0; i < count; i++ )
{
if ( i != n )
wxChoice::DoClear();
- void ** const data = &itemsData[0];
- if ( HasClientObjectData() )
- Append(items, wx_reinterpret_cast(wxClientData **, data));
- else
- Append(items, data);
+ if ( count > 1 )
+ {
+ void ** const data = &itemsData[0];
+ if ( HasClientObjectData() )
+ Append(items, wx_reinterpret_cast(wxClientData **, data));
+ else
+ Append(items, data);
+ }
+ //else: the control is now empty, nothing to append
}
int wxChoice::FindString( const wxString &string, bool bCase ) const