[REBOL] Re: How to change an existing button's colour
From: kpeters:otaksoft at: 30-Jan-2008 9:00
Here you go, Bob:
The code also shows you how to dis-/enable a btn
as well in one go.
HTH
Kai
;------------------------------------------------------------------
disable: func[ butt [object!] flag [logic!]] [
if all [ flag butt/color = gray ][ exit ] ; don't disable twice
;
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
]
]
;-----------------------------------------------------------------
form: center-face layout [
btn-a: btn "Enable bottom button" [ disable btn-c false ]
btn-b: btn "Disable bottom button" [ disable btn-c true ]
btn-c: btn "Say hello" [ notify "Hi there!" ] sky colors [ sky sky ]
]
;-----------------------------------------------------------------
view form
do-events