Page 1 of 1
setting roundRect radius ?
Posted: Tue Apr 06, 2021 10:26 pm
by liveme
Hi ppl,
Code: Select all
set the style of button "ButtonMY" to roundRect
Can you set the Radius of the button using roundRect ?
Tks
Re: setting roundRect radius ?
Posted: Tue Apr 06, 2021 10:41 pm
by dunbarx
Maybe use a roundRect graphic? Should work just as well, and you can set the radius.
Craig
Re: setting roundRect radius ?
Posted: Wed Apr 07, 2021 7:35 am
by richmond62
It should be born in mind that an image, a graphic and even a field can be used as buttons.
In my own work I
NEVER use buttons as they end up looking like crap on other computers,
either because of fonts or because of operating systems: I always use images tuned to look
exactly the way I want them regardless of which computer they turn up on:
-
Re: setting roundRect radius ?
Posted: Wed Apr 07, 2021 7:57 am
by richmond62
Mind you, it would be rather nice if LiveCode could 'do' us a round button or two on the toolbar:
-
-

- tBar.png (27.21 KiB) Viewed 7665 times
-
Enhancement request:
https://quality.livecode.com/show_bug.cgi?id=23151
Re: setting roundRect radius ?
Posted: Wed Apr 07, 2021 8:09 am
by richmond62
-
If SuperCard could provide a scaleable round button for donkey's ages
there is no earthly reason why the good folk at LiveCode central cannot
provide us with one.
Re: setting roundRect radius ?
Posted: Wed Apr 07, 2021 8:50 am
by liveme
Thanks people,
Ok, I'll give a look at using an image as a button if that results in a cooler look - I thought built-in Buttons were alreay the best way to get the most aestetical display...
Hope its not too hard to get a nice Words display, would using a selected font - like ubuntu font display fine on all plateforms, Mac, Win, etc.. ?
thks
Re: setting roundRect radius ?
Posted: Wed Apr 07, 2021 8:54 am
by richmond62
An image as a button guarantees a consistent appearance everywhere.
You have NO guarantee that a user on Windows 10 will have the Ubuntu font installed
on their computer (in fact the likelihood is almost zero).
Re: setting roundRect radius ?
Posted: Wed Apr 07, 2021 9:14 am
by liveme
About the Font, does LC integrate some fonts in the built App, or can one specified so ....or just leaving LC selecting some default font gives the best results ?
I'm guessing using an image as a button still requires one to include some font for the Text part of it !
Re: setting roundRect radius ?
Posted: Wed Apr 07, 2021 9:48 am
by richmond62
I'm guessing using an image as a button still requires one to include some font for the Text part of it !
No, that's not a requirement.
Here's perhaps the easiest way to get what you want:
-
-
Set up a button with the font to require EXACTLY the way you want it to look
and then IMPORT a SNAPSHOT of it: you will end up with an image of your button.
Then delete your original button.
Of course you can assemble all sorts of components and then GROUP them, and then IMPORT
a SNAPSHOT of the GROUP . . .
. . . such as a CIRCULAR GRAPHIC with TEXT in a FIELD on top of it.
Re: setting roundRect radius ?
Posted: Wed Apr 07, 2021 10:07 am
by liveme
Cool, very interesting...

Re: setting roundRect radius ?
Posted: Wed Apr 07, 2021 10:18 am
by liveme
What's the Command to clic on an image so it act as a button ?
I've used "on mouseDown" in a Script..but nothing seems to happen... (not going to the Target Card)
beside, its quite static, no push down move...to be expected

Re: setting roundRect radius ?
Posted: Wed Apr 07, 2021 10:57 am
by richmond62
Try this:
Code: Select all
on mouseEnter
lock screen
set the coloroverlay["color"] of me to blue
set the coloroverlay["opacity"] of me to "75"
unlock screen
end mouseEnter
on mouseLeave
set the outerGlow of me to empty
set the colorOverlay of me to empty
end mouseLeave
on mouseDown
set the ink of me to notsrcor
end mouseDown
on mouseUp
set the ink of me to srcCopy
go next card
end mouseUp
Re: setting roundRect radius ?
Posted: Wed Apr 07, 2021 12:22 pm
by Klaus
liveme wrote: ↑Wed Apr 07, 2021 10:18 am
I've used "on mouseDown" in a Script..but nothing seems to happen... (not going to the Target Card)...
All "mouseevents" are working with images, too!
What exactly did you script?
Please post your script.
Re: setting roundRect radius ?
Posted: Wed Apr 07, 2021 2:56 pm
by dunbarx
Richmond is very experienced with images, and certainly if you want to really get fancy, follow his lead.
But you initially only wanted to be able to change the corner radii of a button.
Here is a roundRect graphic that I made in 40 seconds.

- Screen Shot 2021-04-07 at 9.42.52 AM.png (4.15 KiB) Viewed 7475 times
The corner radius is a single setting, and is open in the inspector. It has already been discussed that whatever object you finally end up with, all the standard messages are used in all the same ways, like "mouseUp".
Craig
Re: setting roundRect radius ?
Posted: Wed Apr 07, 2021 4:29 pm
by jacque
You can include a font in the app. Put the font file in the Copy Files pane of the standalone settings and start using it when the app opens. See "start using font" in the dictionary.
I prefer using graphics for custom buttons because images don't scale well. I'd use Craig's example and add your own font to the app. For any custom control you do need to script hiliting and other behaviors.