AW: Can you realise a transparent hover color for buttons?

Ken Ray kray at sonsothunder.com
Fri Sep 12 02:49:03 EDT 2008


> that does almost the trick, beside the blendlevel does affect not only the
> backgroundcolor, but also the text.

So you want the everything but the text to go transparent? You mentioned
"like the menu items of MS Office products on Win" - which version of Office
are you talking about?

If you wanted to keep the text from blending but have everything else blend,
you could overlay a transparent button on top of one that was blended 50%;
if you need to have an icon attached to the button (so the text is below the
icon), the transparent button's icon would be 0 and you would need to set
the margins of the transparent button to shift the text label of the button
down to match.

Here's an example of what I mean (Rev 2.9, Windows):

1) Drag a push button off of the Tools palette
2) Open the inspector and assign icon ID 210001 (the stop sign) to the
button, and change the height to 65.
3) Control-drag off a copy of the button.
4) Execute "set the blendLevel of btn 1 to 50" in the message box.
5) Select the copy (btn 2), and remove the icon, change the style to
Transparent.
6) Execute "set the loc of btn 2 to the loc of btn 1" in the message box to
overlay the two buttons.
7) Execute "set the margins of btn 2 to 4,50,4,4" in the message box.

You should now have a 50% blended button, but with black text. To see the
hover effect, set the script of btn 2 to:

on mouseEnter
  set the blendLevel of btn 1 to 0
end mouseEnter

on mouseLeave
  set the blendLevel of btn 1 to 50
end mouseLeave

This may not be exactly what you're looking for, but perhaps it will give
you some ideas of what you can do...

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/





More information about the use-livecode mailing list