Setting the WIDTH of a button to accommodate its text
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 9477
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Setting the WIDTH of a button to accommodate its text
I should like to have a button where an end-user can set its label: now, obviously, if that label is longer than the width of the button the whole thing will look daft:
- -
So, I should like to know, how, when my theoretical end-user sets a label for a button the button can widen (or narrow) to accommodate that label programmatically.
-
- -
So, I should like to know, how, when my theoretical end-user sets a label for a button the button can widen (or narrow) to accommodate that label programmatically.
-
-
- Livecode Opensource Backer
- Posts: 9477
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Setting the WIDTH of a button to accommodate its text
Thanks.
The ONLY problem is that I am messing around with a rectangular graphic as a fake button: and I don't suppose that has a formattedWidth.
The ONLY problem is that I am messing around with a rectangular graphic as a fake button: and I don't suppose that has a formattedWidth.
Re: Setting the WIDTH of a button to accommodate its text
Then you are licked!
-
- Livecode Opensource Backer
- Posts: 9477
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Setting the WIDTH of a button to accommodate its text
No: I am not!
The image 'aqua' and the button 'bHOLDER' are invisible.
Code: Select all
on resizeControl
set the height of img "aqua" to the height of me
set the backGroundPattern of me to the id of img "aqua"
set the loc of img "aqua" to the loc of me
set the loc btn "bHOLDER" to the loc of me
set the textSize of me to ((the height of me)/2)
set the textSize of btn "bHOLDER" to ((the height of me)/2)
set the label of btn "bHOLDER" to the short name of me
set the width of btn "bHOLDER" to the formattedWidth of btn "bHOLDER"
set the height of btn "bHOLDER" to the formattedHeight of btn "bHOLDER"
set the width of me to ((the formattedWidth of btn "bHOLDER") + 20)
set the loc btn "bHOLDER" to the loc of me
end resizeControl
- Attachments
-
- Lick Me Too.livecode.zip
- Stack
- (1.72 KiB) Downloaded 73 times
Re: Setting the WIDTH of a button to accommodate its text
Yeah, that's what I wanted to see!
-
- Livecode Opensource Backer
- Posts: 9477
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Setting the WIDTH of a button to accommodate its text
This whole experiment came about when I realised that for some bloody bad reason there seems to be no way to set rounding of a button's corners:
- -
As soon as a button is made larger than the size at which it comes off the Tools palette its corners go square.
- -
- -
As soon as a button is made larger than the size at which it comes off the Tools palette its corners go square.
- -
-
- Livecode Opensource Backer
- Posts: 9477
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Setting the WIDTH of a button to accommodate its text
While one CAN set the style of a button to 'rounded corners' the cornerRadius cannot be adjusted:
- -
https://forums.livecode.com/viewtopic.php?t=18944
- -
https://forums.livecode.com/viewtopic.php?t=18944
-
- Livecode Opensource Backer
- Posts: 9477
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria