summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/option_button.cpp9
-rw-r--r--scene/gui/popup_menu.cpp3
-rw-r--r--scene/gui/texture_button.cpp2
3 files changed, 10 insertions, 4 deletions
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index ff94a37be0..3cc5acc1a6 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -77,9 +77,14 @@ void OptionButton::_selected(int p_which) {
}
}
- ERR_FAIL_COND(selid==-1);
+ if (selid==-1 && p_which>=0 && p_which<popup->get_item_count()) {
+ _select(p_which,true);
+ } else {
- _select(selid,true);
+ ERR_FAIL_COND(selid==-1);
+
+ _select(selid,true);
+ }
}
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 25e39c1891..9dc03272b2 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -370,7 +370,7 @@ void PopupMenu::_input_event(const InputEvent &p_event) {
}
int over=_get_mouse_over(Point2(m.x,m.y));
- int id = (over<0 || items[over].separator || items[over].disabled)?-1:items[over].ID;
+ int id = (over<0 || items[over].separator || items[over].disabled)?-1:(items[over].ID>=0?items[over].ID:over);
if (id<0) {
mouse_over=-1;
@@ -753,6 +753,7 @@ int PopupMenu::find_item_by_accelerator(uint32_t p_accel) const {
void PopupMenu::activate_item(int p_item) {
+
ERR_FAIL_INDEX(p_item,items.size());
ERR_FAIL_COND(items[p_item].separator);
int id = items[p_item].ID>=0?items[p_item].ID:p_item;
diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp
index 1322eeb0c3..7e6bf2cbdf 100644
--- a/scene/gui/texture_button.cpp
+++ b/scene/gui/texture_button.cpp
@@ -163,7 +163,7 @@ void TextureButton::_bind_methods() {
ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT,"textures/disabled",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_disabled_texture"), _SCS("get_disabled_texture"));
ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT,"textures/focused",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_focused_texture"), _SCS("get_focused_texture"));
ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT,"textures/click_mask",PROPERTY_HINT_RESOURCE_TYPE,"BitMap"), _SCS("set_click_mask"), _SCS("get_click_mask")) ;
- ADD_PROPERTYNO(PropertyInfo(Variant::VECTOR2,"params/scale",PROPERTY_HINT_RANGE,"0.01,1024,0.01"), _SCS("set_texture_scale"), _SCS("set_texture_scale"));
+ ADD_PROPERTYNO(PropertyInfo(Variant::VECTOR2,"params/scale",PROPERTY_HINT_RANGE,"0.01,1024,0.01"), _SCS("set_texture_scale"), _SCS("get_texture_scale"));
ADD_PROPERTYNO(PropertyInfo(Variant::COLOR,"params/modulate"), _SCS("set_modulate"), _SCS("get_modulate"));
}