From: sapier Date: Sat, 14 Jun 2014 10:27:56 +0000 (+0200) Subject: Make dropdown formspec elements send their value same style as buttons on change X-Git-Tag: 0.4.10~74 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=refs%2Fpull%2F1373%2Fhead;p=oweals%2Fminetest.git Make dropdown formspec elements send their value same style as buttons on change --- diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index 48bdf2d50..c16600733 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -2723,8 +2723,9 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event) return true; } } - if((event.GUIEvent.EventType==gui::EGET_BUTTON_CLICKED) || - (event.GUIEvent.EventType==gui::EGET_CHECKBOX_CHANGED)) { + if((event.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED) || + (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED) || + (event.GUIEvent.EventType == gui::EGET_COMBO_BOX_CHANGED)) { unsigned int btn_id = event.GUIEvent.Caller->getID(); if (btn_id == 257) { @@ -2756,14 +2757,36 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event) } return true; } else { - acceptInput(); + acceptInput(quit_mode_no); s.send = false; return true; } } + if ((s.ftype == f_DropDown) && + (s.fid == event.GUIEvent.Caller->getID())) { + // only send the changed dropdown + for(u32 i=0; igetID() > 257) { if (m_allowclose) { @@ -2778,7 +2801,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event) } } - if(event.GUIEvent.EventType==gui::EGET_TABLE_CHANGED) { + if(event.GUIEvent.EventType == gui::EGET_TABLE_CHANGED) { int current_id = event.GUIEvent.Caller->getID(); if(current_id > 257) { // find the element that was clicked