[REBOL] Re: Menu in REBOL-View
From: mike:yaunish:shaw:ca at: 1-Nov-2004 18:20
Hi Cyphre, have found that I am in need of the following and thought I
would pass along
what I have cobbled together.
1.) has-user-data? - Determine if any given face is actually an active
gadget. Should inactive gadgets
have a default behaviour that makes them
check if they are valid before they can do
anything?
2.) update-check - Updates the check box. Maybe this should be built into
my-list as a default
behaviour of the check box. Don't know enough
to make this happen.
3.) get-selected-checks - Returns all check boxes that have been defined
with a 'text field and been
checked off.
Small sample of what I mean.
;------------------------- code starts -----------------------------------
REBOL [
title: "text list style - example"
author: [cyphre--seznam--cz]
]
do http://members.shaw.ca/mike.yaunish/rebol/cyphre-list.r
demo-data: copy []
for i 1 5 1 [ ;definition of simple data dialect (static for now...)
insert/only tail demo-data compose/deep [
[data (false) type "check" text (i)]
[ text (i) ]
[ text (random "The Name of A Company" ) ]
[data (false) type "check" text (i + 100)]
]
]
view l: layout [
origin 0
space 0
across
lst: my-list 640x300 columns [
check 55x25 [ ; check box template
lst/update-check face
]
button 70 [
either lst/has-user-data? face [
print face/user-data/text
][ print "Unassigned button" ]
]
txt 100
check 35x25 [ ; check box template
lst/update-check face
]
]
data demo-data ;sepcifies the data for the list
rowbar ["Select" "ID" "Company" "X"] ;rowbar labels for each column
line-colors reduce [220.220.220 white]
rowbar-height 28
slider-width 20
row-highlight
return
button 150x24 "get-selected-checks" [
print [ "check boxes selected = " mold lst/get-selected-checks ]
]
]
; ------------------ code ends