Round Buttons?

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10096
Joined: Fri Feb 19, 2010 10:17 am

Round Buttons?

Post by richmond62 » Fri Sep 13, 2024 1:16 pm

Is there a relatively simple way (i.e. inwith LiveCode) to make new controls such as round buttons?
-
Screenshot 2024-09-13 at 15.15.55.png
Screenshot 2024-09-13 at 15.15.55.png (40.24 KiB) Viewed 7979 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10096
Joined: Fri Feb 19, 2010 10:17 am

Re: Round Buttons?

Post by richmond62 » Fri Sep 13, 2024 1:41 pm

Who made the decision that a button cannot have the property roundRadius?

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Round Buttons?

Post by Klaus » Fri Sep 13, 2024 1:53 pm

You could use the free "Universal button" widget from Ralf Bitter.
https://github.com/revig/universal-butt ... t/releases
Set the corneradius to 90° and there you go... :-)
Bildschirmfoto 2024-09-13 um 14.51.42.png
Bildschirmfoto 2024-09-13 um 14.51.42.png (32.29 KiB) Viewed 7970 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10096
Joined: Fri Feb 19, 2010 10:17 am

Re: Round Buttons?

Post by richmond62 » Fri Sep 13, 2024 2:08 pm

Thank you, Klaus: I'll give that a try, even if it doesn't answer my question. 8)

viewtopic.php?t=26983
Last edited by richmond62 on Fri Sep 13, 2024 2:12 pm, edited 1 time in total.

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Round Buttons?

Post by Klaus » Fri Sep 13, 2024 2:10 pm

OK, the answer is NO. :-)
Doing so within LC will require scripting and probably even a group of controls

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10096
Joined: Fri Feb 19, 2010 10:17 am

Re: Round Buttons?

Post by richmond62 » Fri Sep 13, 2024 2:13 pm

Doing so within LC will require scripting and probably even a group of controls
I have done this about 15 times in the last 22 years! Just wondering if there was not a more permanent solution.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Round Buttons?

Post by dunbarx » Fri Sep 13, 2024 4:20 pm

Richmond.

Buttons in LC are a predefined object class; their several fixed variants each do their own thing. In other words, are you looking for some new native functionality? If so, you need to roll your own.

So for someone as prolific as you at using images, apart from the "look" of a button (which should be easy) what do you want to do?

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10096
Joined: Fri Feb 19, 2010 10:17 am

Re: Round Buttons?

Post by richmond62 » Fri Sep 13, 2024 4:42 pm

So for someone as prolific as you at using images
A button that is round.

As per my earlier mockup.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Round Buttons?

Post by dunbarx » Fri Sep 13, 2024 8:42 pm

A button that is round.

As per my earlier mockup
I see, a button that is round.

There isn't one, of course. Have you tried setting the icon of a button that is stripped of most of its visible properties? At least that is actually a native button, and if you can find a plain, empty circular icon you are done.

But why not just use a circle graphic or circular image that acts just like a button? I know you can make such a thing, and unless the widget that Klaus mentioned has some way to set its shape, I do not see much of an issue overall.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Round Buttons?

Post by dunbarx » Fri Sep 13, 2024 8:47 pm

Richmond wrote:
...to make new controls such as round buttons?
Aha. To "make new controls"

So the issue is not how to make a round button, but to make new object classes, or at least add variants to existing ones? In other words, forget about combo boxes, rather, make an exploding button. That means modifying the engine, no?

Craig

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Round Buttons?

Post by stam » Fri Sep 13, 2024 11:08 pm

The 3 ways you can add a new control are with an LCB widget (requires learning LCB), a Script Widget (standard LCS but with a lot of extra work needed) or with a group. The group is the easier approach but not easy to have a property inspector, can't by default add to toolbar, etc. But it's very much something that would look and behave like a button or other control and can potentially lend itself to being converted to a script widget.

But to do this right, no matter which approach is chosen, a *lot* of work is needed for relatively little gain, whereas Ralph's Universal Button does it all and, it looks, behaves and smells like a button. So seems like a no-brainer. Unless of course the real question is not about a round button at all, but a general approach about how to make 'new controls', in which case I'd revert to one of the above.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10096
Joined: Fri Feb 19, 2010 10:17 am

Re: Round Buttons?

Post by richmond62 » Sat Sep 14, 2024 4:53 pm

There isn't one, of course.
Is that a fact?
-
Screenshot 2024-09-14 at 18.35.53.png
-
Screenshot 2024-09-14 at 18.39.39.png
-
Admittedly the text is in a crappy position . . .

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Round Buttons?

Post by stam » Sat Sep 14, 2024 9:07 pm

richmond62 wrote:
Sat Sep 14, 2024 4:53 pm
Admittedly the text is in a crappy position . . .
Since beyond a round button you are seeing to align an icon and text as well:
https://github.com/revig/universal-button-widget

or roll your own as a group or script widget, or stick with a subpar solution. No one minds.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Round Buttons?

Post by dunbarx » Sat Sep 14, 2024 9:17 pm

Richmond.
Is that a fact?
I think so.

Setting the style of button to oval is not the same as having a round button. Such a button still has a standard rect property, and the areas within the four corners that "surround" the round-looking part respond to mouse clicks. A truly round button would not.

And a property as, say, the "topLeft" is at the usual corner, not at the 135° point on the visible circle. They are still "rectangular" buttons.

Unless I misunderstood you earlier, you wanted a round button, not a round-looking button. 8)

Craig

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Round Buttons?

Post by stam » Sat Sep 14, 2024 9:27 pm

dunbarx wrote:
Sat Sep 14, 2024 9:17 pm
Setting the style of button to oval is not the same as having a round button. Such a button still has a standard rect property, and the areas within the four corners that "surround" the round-looking part respond to mouse clicks. A truly round button would not.

And a property as, say, the "topLeft" is at the usual corner, not at the 135° point on the visible circle. They are still "rectangular" buttons.
I'm not sure I understand your argument there Craig - a "topLeft" cannot exist for a circle without a square rect...

In fact in any environment I've ever used (which is not that many, admittedly but is more than a handful), all circular structures are considered ovals with same width/height and utilise a square rect. I've never seen a "truly round button" that doesn't behave like that, so not sure that's a true argument ;)

Or are u just funning Richmond ;)

Post Reply