[REBOL] Re: Button Highlight
From: carl::cybercraft::co::nz at: 24-Dec-2003 22:22
On 30-Jun-03, Daril Ng wrote:
> While buttons are on the discussion, how does one
> remove a highlight from a button so that button text
> does not change color when the mouse pointer hovers
> over?
> Not a urgent problem, but thanks for advice!
Hi Daril,
The button's highlighting is controlled by its feel. You can see the
code for it here...
>> view layout [b: button "text"]
>> probe b/feel
make object! [
redraw: func [face act pos /local state][
face/edge/effect: pick [ibevel bevel] face/state
if face/texts [face/text: face/texts/1]
all [face/state face/texts face/text: any [face/texts/2
face/texts/1]]
state: either not face/state [face/blinker] [true]
if face/colors [face/color: pick face/colors not state]
if face/effects [face/effect: pick face/effects not state]
]
detect: none
over: func [face action event][
if all [face/font face/font/colors] [
face/font/color: pick face/font/colors not action
show face
face/font/color: first face/font/colors
]
]
engage: func [face action event][
switch action [
time [if not face/state [face/blinker: not face/blinker]]
down [face/state: on]
alt-down [face/state: on]
up [if face/state [do-face face none] face/state: off]
alt-up [if face/state [do-face-alt face none] face/state:
off]
over [face/state: on]
away [face/state: off]
]
cue face action
show face
]
cue: none
blink: none
]
So, by just getting rid of the 'over function above we can get rid of
the highlighting...
>> view layout [b: button "text" feel [over: none]]
Incidentally, in the latest beta Views there's a new style called 'btn
which gives rounded buttons without any highlighting of the text.
--
Carl Read