Formatted Width of a Tabbed button

Ken Ray kray at sonsothunder.com
Tue Feb 7 20:55:28 CST 2006


On 2/7/06 7:12 PM, "Ray Horsley" <ray at linkitonline.com> wrote:

> I'm just trying to find out how wide I have to make the button in order
> to see all the tabs.  Unlike other button styles, a tabbed button shows
> all lines of its contents, but the formattedWidth property only returns
> the width of one line of the contents.  I'd like to get the width of
> all the contents as they're displayed horizontally.
> 
> Thanks for your concern.  Let me know if you've got any ideas.

Here you go, Ray... try this:

on mouseUp
  put tabFormattedWidth(long id of btn 1) into tWidth
  set the width of btn 1 to tWidth
end mouseUp

function tabFormattedWidth pBtnDesc
  put the text of pBtnDesc into tTabs
  lock screen
  put 0 into tWidth
  put the number of lines of tTabs into tNum
  put the label of pBtnDesc into tOrigLabel
  repeat with x = 1 to tNum
    set the label of pBtnDesc to (line x of tTabs)
    put the formattedWidth of pBtnDesc into tFW
    add tFW to tWidth
  end repeat
  put tWidth + (18* tNum) into tWidth
  set the label of pBtnDesc to tOrigLabel
  unlock screen
  return tWidth
end tabFormattedWidth

HTH,

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



More information about the metacard mailing list