Set button width to the width of its label?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Set button width to the width of its label?
I'm programmatically creating buttons, but I can't figure out how to set the width of the button to the width of its label programmatically.
How do I get the width of a buttons label?
How do I get the width of a buttons label?
Marcus
Re: Set button width to the width of its label?
Hah, I just found it..
set the width of btn "btnName" to the formattedWidth of btn "btnName"
set the width of btn "btnName" to the formattedWidth of btn "btnName"
Marcus
Re: Set button width to the width of its label?
I know, older thread that was answered by the OP no less. But I find myself in a similar situation, with a menu button. Even though the button resizes using the above the way I want it to, the 'menu' below it stays the width of the button. Is there a way to have the button one size, and the menu part a different size?
-
- VIP Livecode Opensource Backer
- Posts: 9582
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Set button width to the width of its label?
Bogs.
Not positive, but I believe the actual menu portion of these gadgets are drawn by the OS, not by LC, so I am not sure you can do anything about that. You can always roll your own, of course.
Craig
Not positive, but I believe the actual menu portion of these gadgets are drawn by the OS, not by LC, so I am not sure you can do anything about that. You can always roll your own, of course.
Craig
Re: Set button width to the width of its label?
Thanks Craig, I suspect your right, and I very well may wind up doing exactly that since I've already rolled the entire dialog so far Of course, if it isn't and someone knows what I'm missing, I'd rather go that route
Re: Set button width to the width of its label?
Thanks Klaus, I suspect your being gently sarcastic (j/k, I am sure he is right).
This is what I am playing with, currently re-creating (without looking at the actual code) a dialog from the original Hc -
and here is what I've come up with -
Anyhoo, I think the problem I was trying to solve actually has 2 components. It looks like Hc used the width of the longest item in the menu, instead of what was in the button, like so -
The problem this leaves for me to resolve is the icon spacing from the text in the button. I'm using of course the icon and text align right for the button, if the space is much larger than needed, the icon gets dramatically farther away from the text and makes it look funny -
These are all cosmetic issues, functionally, the dialog already works as I was looking for it to, but of course the devil is in the details
Re: Set button width to the width of its label?
I am just making a bit fun of your wimpy language skills!
It is spelled, "you are right" or abbreviated "you're right", isn't it?
"I suspect your right" has a complete different meaning, monsieur!
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: Set button width to the width of its label?
It's Wednesday already. Did Klaus get paid?
...and stop calling me Shirley.
...and stop calling me Shirley.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: Set button width to the width of its label?
No, I did not get paid yet, Ethel!
Took a while until I got the "Wimpy" joke, since there are no Wimpy shops in germany at all and the last one I saw was about 45 years ago in the netherlands, specivo in the city of Arnhem.
Took a while until I got the "Wimpy" joke, since there are no Wimpy shops in germany at all and the last one I saw was about 45 years ago in the netherlands, specivo in the city of Arnhem.
Re: Set button width to the width of its label?
Ugh, and here I thought Popeye was universal.
I am wot I am and thats all wot I am, ugh ugh ugh
Re: Set button width to the width of its label?
Thats the ticket