Dynamic labels for buttons with (oddshaped) icon images?
Wilhelm Sanke
sanke at hrz.uni-kassel.de
Wed Feb 11 09:45:53 EST 2009
After some further contemplation it occurs to me that we really do not
need complex scripts (considering textsize, textheight, image height,
button height in various combinations) to set a label on top of an icon,
but that we can achieve most of the necessary adjustments manually with
the possible exception perhaps of a scrollbar script like this:
on scrollbarDrag x
put x into tTopMargin
put x into tBottomMargin
set the margins of btn "x" to 0,tTopMargin,0,tBottomMargin
end scrollbarDrag
Recommended steps of a mostly "manual" procedure:
- set the showname of the button to false
- assign an icon to the button
- adjust the button size so that the icon image is fully displayed
- set the showname of the button to true
(the height of the button will be increased automatically with this step)
- now use the scrollbar to adjust the position of the label / name
- then group the button
- finally adjust the rect of the group manually to show only the icon
part of the button
The grouped icon button can than be copied and pasted as often as is
needed in a given application.
You now have a number of icon buttons whose labels can be changed at
runtime.-
(After you have solved a chess problem, you often have the feeling that
the solution really was obvious in the first place.)
Regards,
Wilhelm Sanke
<http://www.sanke.org/MetaMedia>
More information about the use-livecode
mailing list