Created
October 19, 2016 08:37
-
-
Save DideC/fb8143eaca5f5bfe03e7722ec23e336c to your computer and use it in GitHub Desktop.
Tiny VID utility func and test (find-window, focus)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
title: "Test of `find-window and `focus funcs" | |
author: "Didier Cadieu" | |
] | |
find-window: func [ | |
"Find a face's window face." | |
face [object!] | |
][ | |
while [face/parent] [face: face/parent] | |
face | |
] | |
focus: func [ | |
"Set the focus to the face" | |
face [object!] | |
/local win | |
][ | |
if win: find-window face [win/selected: face] | |
] | |
; TESTS | |
w1: view/no-wait/options [ | |
text "Test focus" | |
f1: field | |
f2: field | |
f3: field | |
button "f1" [focus f1] | |
button "f2" [focus f2] | |
button "f3" [focus f3] | |
] [offset: 100x100] | |
w2: view/no-wait/options [ | |
f4: field | |
f5: field | |
f6: field | |
button "f1" [focus f1] | |
button "f4" [focus f4] | |
button "f5" [focus f5] | |
button "f6" [focus f6] | |
] [offset: 100x200] | |
do-events |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the code that I have been looking for recently, thank you!