Dynamic labels for buttons with (oddshaped) icon images?

Klaus Major klaus at major-k.de
Fri Feb 6 04:01:00 EST 2009


Hi Jaqueline,

> Scott Rossi wrote:
>> Recently, J. Landman Gay wrote:
>
>>> I suppose it would be possible to write a little script that would
>>> calculate the font size, compare it to the button height, and  
>>> adjust the
>>> margins.
>> It's possible, but it's not a little script. :-)  I demoed a  
>> customizable
>> button object at the last RevLive conference in Vegas.  One can set  
>> the font
>> of the text, the orientation of the text, margins, and include an  
>> icon
>> (which orients itself as expected, as opposed to the current  
>> behavior). But
>> this all needs to be handled as a group of objects. Features in the  
>> upcoming
>> version of Rev will make this type of control much more practical  
>> for end
>> users.
>
> I was thinking of something much simpler, just as a work-around.  
> Something like this:
>
> put (the height of btn 1 - the textheight of btn 1) div 2 into tMargin
> set the margins of btn 1 to 0,tMargin,0,tMargin
>
> No bells and whistles though, it just mashes the name into the  
> center. The math may need some jiggl...um, adjustments.

:-)

Tested a bit and did some finetuning:
...
  put (the height of btn 1 - the textheight of btn 1 - the effective  
textsize of btn 1) div 2 into tMargin
  set the margins of btn 1 to 0,tMargin,0,tMargin
...

> Yours is much prettier. Everything you do is much prettier.

No doubt, but he's a graphics guy, you know?! ;-)

> -- 
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com

Best

Klaus

--
Klaus Major
klaus at major-k.de
http://www.major-k.de




More information about the Use-livecode mailing list