[REBOL] Re: Button en-/disabling revisited
From: kpeters:otaksoft at: 27-Aug-2007 12:43
Thanks, Gabriele ~
that was just the hint I needed - things are looking a lot better now, although another
problem reared its
ugly head:
As you see, I have added a line to prevent disabling from happening twice (as it screws
up the button colors for good).
I would expect to see the alert the second time I press button 'b1 - it does, however,
only show upon the third button press....
Does anyone have a clue as to why?
TIA,
Kai
disable: func[ butt [object!] flag [logic!]] [
if all [ flag butt/user-data = gray ][ alert "gray" exit ] ; don't disable twice - screws
up colors
;
either flag
[ butt/user-data: butt/colors/1
butt/colors: reduce [ gray gray ]
butt/color: gray
show butt
butt/feel: none
]
[ butt/feel: svvf/btn
butt/color: butt/user-data
butt/colors: reduce [ butt/user-data butt/user-data ]
show butt
]
]
scr: center-face layout [
b1: btn 150 sky "Disable lemon" [ disable lemon true ]
b2: btn 150 gold "Enable lemon" [ disable lemon false ]
lemon: btn 150 yellow "Click me" [ flash "Hi bud!" ] colors [ yellow yellow
]
]
view scr