[REBOL] Re: How to change an existing button's colour
From: gregg:pointillistic at: 30-Jan-2008 12:23
Hi Bob,
BW> 1) Change the button colour to a pure red
BW> 2) Cut out the button disabling
The color changing may be not what you want due to the effect block a
the btn uses. The tricky part about messing with that, is that you
need to know more about the internals. As an example, uncomment the
line that changes the effect to nothing. You can see all the source
for the btn style by doing:
>> probe get-style 'btn
To avoid the disabling, you want to leave the /feel facet alone.
change-color: func [butt [object!] color [tuple! none!]] [
either all [color color <> butt/colors/1] [
butt/user-data: butt/colors/1
butt/colors: reduce [color color]
butt/color: color
][
butt/color: butt/user-data
butt/colors: reduce [butt/user-data butt/user-data]
]
;butt/effect: copy []
show butt
]
;-----------------------------------------------------------------
form: center-face layout [
btn-a: btn "Make it red" [change-color btn-c red]
btn-b: btn "Reset its color" [change-color btn-c none]
btn-c: btn "Say hello" [ notify "Hi there!" ] sky colors [ sky sky ]
]
;-----------------------------------------------------------------
view form
do-events
-- Gregg