Fix various focus issues

This commit is contained in:
Jaby 2025-04-05 22:34:30 +02:00
parent af633a4fdf
commit 32da34cad6
2 changed files with 9 additions and 3 deletions

View File

@ -81,6 +81,7 @@ export component MainWindow inherits Window {
public function change_to_main() { public function change_to_main() {
tab_widget.current-index = 1; tab_widget.current-index = 1;
main_tab.set_active();
} }
public function clear_file_tab-current_selected_file() { public function clear_file_tab-current_selected_file() {

View File

@ -31,6 +31,7 @@ export component MainTab inherits Rectangle {
width: group.width + group.x*2; width: group.width + group.x*2;
height: group.height + group.y*2 + 32px; height: group.height + group.y*2 + 32px;
forward-focus: key_focus;
group := GroupBox { group := GroupBox {
title: "VRAM Layout"; title: "VRAM Layout";
@ -293,7 +294,7 @@ export component MainTab inherits Rectangle {
} }
} }
FocusScope { key_focus := FocusScope {
key-pressed(event) => { key-pressed(event) => {
if(vram_files_list.current-item != -1) { if(vram_files_list.current-item != -1) {
if(event.text == Key.LeftArrow) { if(event.text == Key.LeftArrow) {
@ -330,4 +331,8 @@ export component MainTab inherits Rectangle {
cur_sel_y.text = 0; cur_sel_y.text = 0;
cur_sel_img.visible = false; cur_sel_img.visible = false;
} }
public function set_active() {
key_focus.focus();
}
} }