diff --git a/src/app/script/dialog_class.cpp b/src/app/script/dialog_class.cpp index aed2df91a..07712039c 100644 --- a/src/app/script/dialog_class.cpp +++ b/src/app/script/dialog_class.cpp @@ -940,6 +940,29 @@ int Dialog_modify(lua_State* L) } lua_pop(L, 1); + // Handling options before option should support + // using both or only one of them at the same time + type = lua_getfield(L, 2, "options"); + if (type != LUA_TNIL) { + if (lua_istable(L, -1)) { + if (auto combobox = dynamic_cast(widget)) { + combobox->deleteAllItems(); + lua_pushnil(L); + bool empty = true; + while (lua_next(L, -2) != 0) { + if (auto p = lua_tostring(L, -1)) { + combobox->addItem(p); + empty = false; + } + lua_pop(L, 1); + } + if (empty) + combobox->getEntryWidget()->setText(""); + } + } + } + lua_pop(L, 1); + type = lua_getfield(L, 2, "option"); if (auto p = lua_tostring(L, -1)) { if (auto combobox = dynamic_cast(widget)) { @@ -983,7 +1006,7 @@ int Dialog_modify(lua_State* L) } lua_pop(L, 1); - // TODO combobox options? shades mode? file title / open / save / filetypes? on* events? + // TODO shades mode? file title / open / save / filetypes? on* events? if (relayout) { dlg->window.layout();