[REBOL] Re: Checkbox state is not changing - maybe Allen Kamp updates his View
From: geza67:freestart:hu at: 5-Sep-2001 22:49
Hello Anton,
>> >> view layout [ c: check [probe c/state]]
>> > try c/data
>> Quite inconsistent (... as so many aspects of VID ...) - toggles work with
>> /state - but it works.
> Not really.
> I think state is whether gadget is "depressed"
That's the _main_ problem regarding /View, VID etc. We only _think_
about things instead of _knowing_ it surely - with a knowledge based on sound
and behind-the-scenes _information_ (back to basics, i.e. /View's
sparse documentation ... ;-) )
> or not. The check cannot be pushed down in
> current implementation, therefore its state
> should not change.
Then we should inform Allen Kamp that his information on Rebolforces'
View FAQ is incorrect. I tried his checkbox-setting routines on /View
1.2.1.3.1) and neither his methods is working:
First: it shows the layout, but check apears not checked
view layout [chk1: check with [state: true]
Second: simply error ;-(
>> checkers: stylize [
[ true-check check [state: true]
[ ]
== []
>>
>> view layout [styles checkers
[ chk1: true-check chk2: check]
Unknown word or style: true-check
Third: shows layout, no checked checkboxes ...
checks: layout [chk1: check chk2: check]
chk1/state: true
view checks
Fourth: ... the same ...
view layout [chk1: check do [chk1/state: true]]
Because Allen seems to be a positively zealous :-) REBOL personality I
have only one explanation for this behavior of all his code snippets:
In /View 1.x where x<>2 but some earlier release, checkbox's 'state
property _worked_ as expected. Maybe this /View release is buggy in
this respect.
Thus the current one of the checkbox-checking solutions is with 'data :
view layout [c: check do [c/data: true]]
> view layout [b: button [probe b/state]]
> It's always true, because:
> - first you press button, state becomes true (button looks depressed).
> - you let go of button, action occurs.
> - then state becomes false (button looks normal/ready again).
I think your code is rather instructive but: 'probe is fired
AFTER you have released the button thus button is in "up"-position. In
this respect 'state again "lies": it should have been always FALSE.
Maybe it is trivial but as I played around I could simulate a toggle
with a button and a special engage function like this:
rebol[]
view layout [
button feel [
engage: func [face action event] [
if action = 'up [
face/state: not face/state
show face
print [face/state]
]
]
]
]
> Perhaps in future, check will react like button and change
It would be more convenient if the widgets would behave more
uniformly.
--
Best regards,
Geza mailto:[geza67--freestart--hu]