setting roundRect radius ?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm
Location: down under

setting roundRect radius ?

Post by liveme » Tue Apr 06, 2021 10:26 pm

Hi ppl,

Code: Select all

   set the style of button "ButtonMY" to roundRect
Can you set the Radius of the button using roundRect ?
Tks

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9579
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: setting roundRect radius ?

Post by dunbarx » Tue Apr 06, 2021 10:41 pm

Maybe use a roundRect graphic? Should work just as well, and you can set the radius.

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: setting roundRect radius ?

Post by richmond62 » Wed Apr 07, 2021 7:35 am

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:
-
GranthaRaja.jpg

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: setting roundRect radius ?

Post by richmond62 » Wed Apr 07, 2021 7:57 am

Mind you, it would be rather nice if LiveCode could 'do' us a round button or two on the toolbar:
-
SShot 2021-04-07 at 9.47.39.png
-
tBar.png
tBar.png (27.21 KiB) Viewed 5169 times
-

Enhancement request: https://quality.livecode.com/show_bug.cgi?id=23151

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: setting roundRect radius ?

Post by richmond62 » Wed Apr 07, 2021 8:09 am

sCard.png
-
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.
Last edited by richmond62 on Wed Apr 07, 2021 8:52 am, edited 1 time in total.

liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm
Location: down under

Re: setting roundRect radius ?

Post by liveme » Wed Apr 07, 2021 8:50 am

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: setting roundRect radius ?

Post by richmond62 » Wed Apr 07, 2021 8:54 am

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).

liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm
Location: down under

Re: setting roundRect radius ?

Post by liveme » Wed Apr 07, 2021 9:14 am

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 !

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: setting roundRect radius ?

Post by richmond62 » Wed Apr 07, 2021 9:48 am

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:
-
SShot 2021-04-07 at 11.46.46.png
-
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.

liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm
Location: down under

Re: setting roundRect radius ?

Post by liveme » Wed Apr 07, 2021 10:07 am

Cool, very interesting... :idea:

liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm
Location: down under

Re: setting roundRect radius ?

Post by liveme » Wed Apr 07, 2021 10:18 am

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
:|

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: setting roundRect radius ?

Post by richmond62 » Wed Apr 07, 2021 10:57 am

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

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: setting roundRect radius ?

Post by Klaus » Wed Apr 07, 2021 12:22 pm

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.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9579
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: setting roundRect radius ?

Post by dunbarx » Wed Apr 07, 2021 2:56 pm

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
Screen Shot 2021-04-07 at 9.42.52 AM.png (4.15 KiB) Viewed 4979 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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: setting roundRect radius ?

Post by jacque » Wed Apr 07, 2021 4:29 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”