summaryrefslogtreecommitdiff
path: root/scene/gui/popup_menu.cpp
diff options
context:
space:
mode:
authorRicardo Buring <ricardo.buring@gmail.com>2020-10-16 01:04:30 +0200
committerRicardo Buring <ricardo.buring@gmail.com>2022-01-15 22:52:12 +0100
commit4562106cbf1bbb7ae86a49fdee2ba9eeb69bd15e (patch)
tree03d2cddce5d083eb800ec64e6e127cdc14e3bcf7 /scene/gui/popup_menu.cpp
parentc99c5a1caeafab161daebdde21ccd83ecdc897d5 (diff)
OptionButton::pressed(): give focus to selected
Diffstat (limited to 'scene/gui/popup_menu.cpp')
-rw-r--r--scene/gui/popup_menu.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index f4d45fe1fa..d7139d0140 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -1269,6 +1269,13 @@ bool PopupMenu::is_item_shortcut_disabled(int p_idx) const {
return items[p_idx].shortcut_is_disabled;
}
+void PopupMenu::set_current_index(int p_idx) {
+ ERR_FAIL_INDEX(p_idx, items.size());
+ mouse_over = p_idx;
+ _scroll_to_item(mouse_over);
+ control->update();
+}
+
int PopupMenu::get_current_index() const {
return mouse_over;
}