summaryrefslogtreecommitdiffstats
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/option_button.cpp2
-rw-r--r--scene/gui/popup_menu.cpp18
2 files changed, 10 insertions, 10 deletions
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 79018c40f5..26d164a62d 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -178,7 +178,7 @@ bool OptionButton::_set(const StringName &p_name, const Variant &p_value) {
}
void OptionButton::_focused(int p_which) {
- emit_signal(SNAME("item_focused"), p_which);
+ emit_signal(SNAME("item_focused"), popup->get_item_index(p_which));
}
void OptionButton::_selected(int p_which) {
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 3c04094526..f6ebcc854c 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -474,7 +474,7 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
for (int i = search_from; i < items.size(); i++) {
if (!items[i].separator && !items[i].disabled) {
mouse_over = i;
- emit_signal(SNAME("id_focused"), i);
+ emit_signal(SNAME("id_focused"), items[i].id);
scroll_to_item(i);
control->queue_redraw();
set_input_as_handled();
@@ -488,7 +488,7 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
for (int i = 0; i < search_from; i++) {
if (!items[i].separator && !items[i].disabled) {
mouse_over = i;
- emit_signal(SNAME("id_focused"), i);
+ emit_signal(SNAME("id_focused"), items[i].id);
scroll_to_item(i);
control->queue_redraw();
set_input_as_handled();
@@ -512,7 +512,7 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
for (int i = search_from; i >= 0; i--) {
if (!items[i].separator && !items[i].disabled) {
mouse_over = i;
- emit_signal(SNAME("id_focused"), i);
+ emit_signal(SNAME("id_focused"), items[i].id);
scroll_to_item(i);
control->queue_redraw();
set_input_as_handled();
@@ -526,7 +526,7 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
for (int i = items.size() - 1; i >= search_from; i--) {
if (!items[i].separator && !items[i].disabled) {
mouse_over = i;
- emit_signal(SNAME("id_focused"), i);
+ emit_signal(SNAME("id_focused"), items[i].id);
scroll_to_item(i);
control->queue_redraw();
set_input_as_handled();
@@ -692,7 +692,7 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
if (items[i].text.findn(search_string) == 0) {
mouse_over = i;
- emit_signal(SNAME("id_focused"), i);
+ emit_signal(SNAME("id_focused"), items[i].id);
scroll_to_item(i);
control->queue_redraw();
set_input_as_handled();
@@ -1091,7 +1091,7 @@ void PopupMenu::_notification(int p_what) {
for (int i = search_from; i < items.size(); i++) {
if (!items[i].separator && !items[i].disabled) {
mouse_over = i;
- emit_signal(SNAME("id_focused"), i);
+ emit_signal(SNAME("id_focused"), items[i].id);
scroll_to_item(i);
control->queue_redraw();
match_found = true;
@@ -1104,7 +1104,7 @@ void PopupMenu::_notification(int p_what) {
for (int i = 0; i < search_from; i++) {
if (!items[i].separator && !items[i].disabled) {
mouse_over = i;
- emit_signal(SNAME("id_focused"), i);
+ emit_signal(SNAME("id_focused"), items[i].id);
scroll_to_item(i);
control->queue_redraw();
break;
@@ -1124,7 +1124,7 @@ void PopupMenu::_notification(int p_what) {
for (int i = search_from; i >= 0; i--) {
if (!items[i].separator && !items[i].disabled) {
mouse_over = i;
- emit_signal(SNAME("id_focused"), i);
+ emit_signal(SNAME("id_focused"), items[i].id);
scroll_to_item(i);
control->queue_redraw();
match_found = true;
@@ -1137,7 +1137,7 @@ void PopupMenu::_notification(int p_what) {
for (int i = items.size() - 1; i >= search_from; i--) {
if (!items[i].separator && !items[i].disabled) {
mouse_over = i;
- emit_signal(SNAME("id_focused"), i);
+ emit_signal(SNAME("id_focused"), items[i].id);
scroll_to_item(i);
control->queue_redraw();
break;