[REBOL] Using the check-box in REBOL/view Re:
From: allen:rebolforces at: 29-Aug-2000 8:45
>----- Original Message -----
>From: <[toolnes--online--no]>
>To: <[list--rebol--com]>
>Sent: Tuesday, August 29, 2000 4:18 AM
>Subject: [REBOL] Using the check-box in REBOL/view
>Can someone give me an easy example that uses a check-box to change a
variable from "1" to "2" and >label the variable?
The view VID check-box, as it is currently implemented, works as a flag. It
does not trigger an action when its state is changed.
The FAQ has for an example of using the check-box
http://www.rebolforces.com/view-faq.html#section-2
However if you want a check-box that can trigger an action. There is a
example on the RF rebsite (in the style section) called check-style.r on the
RF rebsite shows how to do that.
REBOL [] do http://www.rebolforces.com
The basic script is at the end of this email..
Cheers,
Allen K
;--------------------------
REBOL [
Title: "Check-style"
Author: "Allen Kamp"
Email: [allen--rebolforces--com]
]
; the style
check-style: stylize [
chk check [
feel: make feel [
engage: func [face action event][
if action = 'down [
face/state: not face/state
show face
do face/action
]
]
]
]
]
; the demo
main-face: layout [
styles check-style
backdrop 180.160.120
txt: label 200
{This modified VID 'CHECK style triggers an action
when it is clicked, so you can make changes
that reflect the current state of the checkbox}
with [font: [shadow: none style: 'bold]]
across
label "Shadow Text?" 150 bold
c1: chk [
either c1/state
txt/font/shadow: 4x4
show txt
][
txt/font/shadow: 0x0
show txt
]
] return
label "Highlight Text?" 150 bold
c2: chk [
either c2/state [
system/view/vid/vid-feel/focus txt
system/view/highlight-start: txt/text
system/view/highlight-end: tail txt/text
system/view/caret: head txt/text
show txt
][
system/view/vid/vid-feel/focus none
show txt
]
] return
label "Italics?" 150 bold
c3: chk [
either c3/state
txt/font/style: [italic bold]
show txt
][
txt/font/style: 'bold
show txt
]
]
]
view main-face
;----------------------