extends TabContainer var focus_list: Array func _ready() -> void: for child in get_children(): focus_list.append(_find_selectable_in(child)) func _find_selectable_in(parent:Control) -> Control: if parent.focus_mode != FOCUS_NONE: return parent for child in parent.get_children(): var ret := _find_selectable_in(child) if not ret == self: return ret return self func _unhandled_input(event : InputEvent) -> void: if event.is_action_type(): print_debug("Unhandled Input", event) if event.is_action_type(): if event.is_action_pressed("ui_left"): previous() elif event.is_action_pressed("ui_right"): next() func next() -> void: if current_tab < get_tab_count()-1: if !Input.is_action_just_released("mouse_left"): if not get_viewport().gui_get_focus_owner() == null: focus_list[current_tab] = get_viewport().gui_get_focus_owner() current_tab += 1 focus_list[current_tab].grab_focus() else: current_tab += 1 func previous() -> void: if current_tab > 0: if !Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): if not get_viewport().gui_get_focus_owner() == null: focus_list[current_tab] = get_viewport().gui_get_focus_owner() current_tab -= 1 focus_list[current_tab].grab_focus() else: current_tab -= 1 func notification(what: int, _reversed: bool = false) -> void: if what == NOTIFICATION_VISIBILITY_CHANGED: self.set_process_input(visible)