don't allow setting readonly combobox value to a string which is not one of the valid choices in wxGTK neither and document this behaviour (closes #10549)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59372 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -136,10 +136,20 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
||||
|
||||
if ( entry )
|
||||
{
|
||||
gtk_entry_set_text( entry, wxGTK_CONV(value) );
|
||||
|
||||
if (style & wxCB_READONLY)
|
||||
{
|
||||
// this will assert and do nothing if the value is not in our list
|
||||
// of strings which is the desired behaviour (for consistency with
|
||||
// wxMSW and also because it doesn't make sense to have a string
|
||||
// which is not a possible choice in a read-only combobox)
|
||||
SetStringSelection(value);
|
||||
gtk_entry_set_editable( entry, FALSE );
|
||||
}
|
||||
else // editable combobox
|
||||
{
|
||||
// any value is accepted, even if it's not in our list
|
||||
gtk_entry_set_text( entry, wxGTK_CONV(value) );
|
||||
}
|
||||
|
||||
g_signal_connect_after (entry, "changed",
|
||||
G_CALLBACK (gtkcombobox_text_changed_callback), this);
|
||||
|
Reference in New Issue
Block a user