Displaying Ellipses For Long Button Labels
Note that to retrieve the item that is selected, you would ask for
of the button and not
the label of the button (since the label would be displayed
with the ellipses).
Here's the script that will truncate the label and put an ellipsis after it after having selected a menu item (so although the selectedText of the button is "Process Management", the label displays "Process Mana..."). For more control, change the uMaxSize of the option button.
on stsEllipsis pChoice if the uMaxSize of the target = "" then put the width of the target -15 into tW else put the uMaxSize of the target into tW end if lock screen -- Get width of ellipsis set the label of the target to "..." -- Now work backwards from length of text set the label of the target to pChoice put the formattedWidth of the target into tSize if tSize > tW then put "" into tLabel repeat with x = 1 to length(pChoice) set the label of the target to (char 1 to x of pChoice) & "..." if the formattedWidth of the target > tW then exit repeat else switch (the platform) case "MacOS" put x+1 into tMax break case "Win32" put x+2 into tMax break default put x into tMax break end switch put char 1 to tMax of pChoice & "..." into tLabel end if end repeat set the label of the target to tLabel end if unlock screen end stsEllipsis
To use it, put the following code into the button's
Posted 5/21/2005 by Ken Ray to the Use-Revolution Liston menuPick what stsEllipsis what -- rest of your script goes here end menuPick