Make dropdown formspec elements send their value same style as buttons on change

master
sapier 2014-06-14 12:27:56 +02:00
parent ce9f1e1d3c
commit 2a09b7e84f
1 changed files with 28 additions and 5 deletions

View File

@ -2724,7 +2724,8 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
}
}
if((event.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED) ||
(event.GUIEvent.EventType==gui::EGET_CHECKBOX_CHANGED)) {
(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,11 +2757,33 @@ 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; i<m_fields.size(); i++) {
FieldSpec &s2 = m_fields[i];
if (s2.ftype == f_DropDown) {
s2.send = false;
}
}
s.send = true;
acceptInput(quit_mode_no);
// revert configuration to make sure dropdowns are sent on
// regular button click
for(u32 i=0; i<m_fields.size(); i++) {
FieldSpec &s2 = m_fields[i];
if (s2.ftype == f_DropDown) {
s2.send = true;
}
}
return true;
}
}
}
if(event.GUIEvent.EventType == gui::EGET_EDITBOX_ENTER) {