mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-23 23:13:12 +08:00
Make wxEL_ALLOW_NEW imply wxEL_ALLOW_EDIT in wxEditableListBox
Without this change, using wxEL_ALLOW_NEW without wxEL_ALLOW_EDIT resulted in an assertion failure, so fix it by turning wxEL_ALLOW_EDIT too in this case: this makes sense because adding a new element is "editing" too, and there doesn't seem to be any realistic scenario in which new items can be added but the existing items can't be changed. Closes #24099. Closes #24100.
This commit is contained in:
committed by
Vadim Zeitlin
parent
11ed91af8f
commit
ed02e03585
@@ -19,7 +19,7 @@
|
||||
|
||||
@beginStyleTable
|
||||
@style{wxEL_ALLOW_NEW}
|
||||
Allows the user to enter new strings.
|
||||
Allows the user to enter new strings (implies wxEL_ALLOW_EDIT as well).
|
||||
@style{wxEL_ALLOW_EDIT}
|
||||
Allows the user to edit existing strings.
|
||||
@style{wxEL_ALLOW_DELETE}
|
||||
|
||||
@@ -113,6 +113,10 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
m_style = style;
|
||||
|
||||
// wxEL_ALLOW_NEW requires ability to edit labels so implicitly add wxEL_ALLOW_EDIT
|
||||
if ( m_style & wxEL_ALLOW_NEW )
|
||||
m_style |= wxEL_ALLOW_EDIT;
|
||||
|
||||
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
wxPanel *subp = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||
@@ -167,7 +171,7 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id,
|
||||
sizer->Add(subp, wxSizerFlags().Expand());
|
||||
|
||||
long st = wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL | wxSUNKEN_BORDER;
|
||||
if ( style & wxEL_ALLOW_EDIT )
|
||||
if ( m_style & wxEL_ALLOW_EDIT )
|
||||
st |= wxLC_EDIT_LABELS;
|
||||
m_listCtrl = new CleverListCtrl(this, wxID_ELB_LISTCTRL,
|
||||
wxDefaultPosition, wxDefaultSize, st);
|
||||
|
||||
Reference in New Issue
Block a user