Last active
July 22, 2017 10:58
-
-
Save greggirwin/c67d640f09e9ccd0dac0859ec7374ca3 to your computer and use it in GitHub Desktop.
VID drop-down style demo
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: "Drop-down demo" | |
author: "Gregg Irwin" | |
] | |
; The data facet accepts arbitrary values, but only string values will be added | |
; to the list and displayed. Extra, non-string values can be used to create | |
; associative arrays, using strings as keys. The `selected` facet is a 1-based | |
; integer index, indicating the position of the selected string in the list, | |
; not in the `data` facet. | |
show-action: func [face type][ | |
print [ | |
now/time type | |
"selected:" face/selected | |
"text:" face/text | |
"find*:" mold select face/data face/text | |
"pick*:" mold pick face/data face/selected * 2 | |
] | |
] | |
view [ | |
drop-down | |
data ["Alpha" #1 "Beta" 2x2 "Gamma" #"C"] | |
select 2 ; Set default list item | |
on-select [show-action face 'select] | |
on-change [show-action face 'change] | |
drop-down | |
data [#4 "Delta" 5x5 "Epsilon" %"After Epsilon" #"F" "Zeta"] | |
on-select [show-action face 'select] | |
on-change [show-action face 'change] | |
drop-down | |
data ["A" "B" "C" "D" "E" "F"] | |
on-select [show-action face 'select] | |
on-change [show-action face 'change] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated to show more behavior with non-string data.