Skip to content

Instantly share code, notes, and snippets.

@rebolek
Forked from iArnold/tabtest.red
Last active October 18, 2016 16:35
Show Gist options
  • Save rebolek/86347c89891b1dcdb2950971a0820f5a to your computer and use it in GitHub Desktop.
Save rebolek/86347c89891b1dcdb2950971a0820f5a to your computer and use it in GitHub Desktop.
How to go about adding tab functionality?
;do %/c/../tabtest.red ;-- Everything before the Red header is not a comment!!
Red [
file: %tabtest.red
]
window-actors: object [ ;-- actors for the window
on-key: func [face [object!] event [event!]][
case [
event/key = #"^-" [
print "TAB key caught by window face!"
'stop ;-- This 'stop stops the
]
1 = 1 [
prin "keystroke caught: " print event/key
] ] ] ]
; Main window creation, the visible part of the program ------------------
tab-win: layout [
title "Tab focus test program"
style label: text bold left 70
origin 20x20
label "Above"
above-1: field 40 focus extra 'above-1 ;-- just an idea to make a hook on this
label "Also above"
above-2: field 50 extra 'above-2
return
main-panel: tab-panel 600x500 [
"Panel 1" [
pan1-field1: field "" extra 'pan1-field1
return
pan1-field2: field "" extra 'pan1-field2
return
pan1-field3: field "" extra 'pan1-field3 [
main-panel/selected: 2
tab-win/selected: pan2-field1
]
]
"Panel 2" [
pan2-field1: field "" extra 'pan2-field1
return
pan2-field2: field "" extra 'pan2-field2
return
pan2-field3: field "" extra 'pan2-field3
]
"Panel 3" [
pan3-field1: field "" extra 'pan3-field1
return
pan3-field2: field "" extra 'pan3-field2
return
pan3-field3: field "" extra 'pan3-field3
]
]
return
btn-quit: button "Quit" [unview]
]
tab-win/actors: window-actors
view tab-win
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment