[REBOL] Re: How to change an existing button's colour
From: petr:krenzelok:seznam:cz at: 30-Jan-2008 17:33
Bob Warren napsal(a):
> Hi All,
> Perhaps somebody would be kind enough to help out a Rebol noob who is
> completely lost.
> Using RebGUI, I have found out how to change an existing button's colour
> as follows:
> unless value? 'ctx-rebgui [do-thru http://www.dobeash.com/RebGUI/rebgui.r]
> display "RebGUI Example" [
> text"Click on the WORLD button"
> mybut: button "Hello" red
> button "World" on-click [mybut/color: blue show mybut]
> I want to do something similar in normal Rebol code, but nothing I try
> seems to work.
> Any help would be greatly appreciated.
Eh, long time I did not do that in VID, but you could try following.
Generally in VID, you can specify your color inline
b: btn red green "OK" font-color blue ; beware, this does not work for
You can study your style using "probe get-style 'button".
You can see, there is face/color, face/colors, face/effect,
face/effects. As you can see, old button is colored using following code
(I might be wrong)
if not any [effect effects] [
either color [
effects: reduce [
reduce ['gradient 0x1 color + 32 color - 32]
either all [block? colors colors/2] [
reduce ['gradient 0x-1 colors/2 + 32 color/2
reduce ['gradient 0x-1 color + 32 color - 32]
[gradient 0x1 66.120.192 44.80.132]
[gradient 0x-1 66.120.192 44.80.132]
view layout [b: button "OK" [probe reduce [b/color b/colors b/effect
->> view layout [b: btn red green "OK" font-color yellow [probe reduce
[b/color b/colors b/effect b/effects]]]
[none [255.0.0 0.255.0] [colorize 0.255.0 128 extend 14] none]
Now you can experiment with slots. As it is normal series, you might
succesfully replace elements, e.g.:
Maybe VID gurus step-in and they will be able to help you some more ...