File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1908,6 +1908,30 @@ LuaDialog* LuaDialog::modify(sol::table options) {
19081908 if (props[" text" ].valid ()) {
19091909 ctrl->SetLabel (wxString (props.get_or (std::string (" text" ), " " s)));
19101910 }
1911+ } else if (widget.type == " combobox" ) {
1912+ wxChoice* ctrl = static_cast <wxChoice*>(widget.widget );
1913+ if (props[" options" ].valid ()) {
1914+ ctrl->Freeze ();
1915+ ctrl->Clear ();
1916+ sol::table opts = props[" options" ];
1917+ for (size_t i = 1 ; i <= opts.size (); ++i) {
1918+ if (opts[i].valid ()) {
1919+ ctrl->Append (wxString (opts[i].get <std::string>()));
1920+ }
1921+ }
1922+ ctrl->Thaw ();
1923+ }
1924+ if (props[" option" ].valid ()) {
1925+ std::string selected = props.get_or (std::string (" option" ), " " s);
1926+ int idx = ctrl->FindString (wxString (selected));
1927+ if (idx != wxNOT_FOUND) {
1928+ ctrl->SetSelection (idx);
1929+ values[id] = sol::make_object (lua, selected);
1930+ }
1931+ } else if (ctrl->GetCount () > 0 && ctrl->GetSelection () == wxNOT_FOUND) {
1932+ ctrl->SetSelection (0 );
1933+ values[id] = sol::make_object (lua, ctrl->GetString (0 ).ToStdString ());
1934+ }
19111935 } else if (widget.type == " list" ) {
19121936 LuaDialogListBox* ctrl = static_cast <LuaDialogListBox*>(widget.widget );
19131937 if (props[" icon_width" ].valid () || props[" icon_height" ].valid () || props[" icon_size" ].valid ()) {
You can’t perform that action at this time.
0 commit comments