mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Handle complex forward-focus loops
This commit is contained in:
parent
7e7b9176a7
commit
ae1fb4c7cf
2 changed files with 28 additions and 2 deletions
|
@ -38,6 +38,24 @@ export Y := FocusScope {
|
|||
forward-focus: self;
|
||||
// ^error{forward-focus can't refer to itself}
|
||||
x:= X { }
|
||||
key-pressed => { x.focus(); accept }
|
||||
// ^error{focus\(\) can only be called on focusable elements}
|
||||
key-pressed => {
|
||||
r0.focus();
|
||||
x.focus();
|
||||
// ^error{focus\(\) can only be called on focusable elements}
|
||||
accept
|
||||
}
|
||||
|
||||
r1:= Rectangle {
|
||||
forward-focus: r2;
|
||||
}
|
||||
r0:= Rectangle {
|
||||
forward-focus: r1;
|
||||
}
|
||||
r2 := Rectangle {
|
||||
forward-focus: r3;
|
||||
}
|
||||
r3 := Rectangle {
|
||||
forward-focus: r1;
|
||||
// ^error{forward-focus loop}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue