Page 1 of 2

create widget

Posted: Thu Aug 18, 2022 8:26 pm
by Samuele
Hi, Is there a way to create a widget? in my case, I want to create a switch button, or at least change the one already existing in livecode, is it possible?
Thanks

Re: create widget

Posted: Thu Aug 18, 2022 8:51 pm
by stam
There are lessons on this showing you how to use livecode builder… just search the website for these. But it’s a lot to learn and the language is not what you know…

Re: create widget

Posted: Thu Aug 18, 2022 8:52 pm
by Klaus
Hi Samuele,

what Stam said!
Check these lessons: https://lessons.livecode.com/m/98524


Best

Klaus

Re: create widget

Posted: Thu Aug 18, 2022 8:52 pm
by richmond62
https://livecode.com/topic/extending-livecode-guide/

Personally I have never looked at that at all as I do not need it for any of my requirements.

Re: create widget

Posted: Thu Aug 18, 2022 10:33 pm
by dunbarx
Samuele.

What sort of switch? I bet it can easily be done in LC script.

Craig

Re: create widget

Posted: Thu Sep 29, 2022 12:02 pm
by Samuele
Hi, been studying :lol: I just want it to look a bit different from the one given for android

Re: create widget

Posted: Thu Sep 29, 2022 12:13 pm
by richmond62
OK, OK . . .

As LCB is quite a bit more difficult than LiveCode itself why don't you do this:

1. Draw a picture of what you want and post it here.

2. Explain exactly what you want your 'switcher' button to do.

Then we can see if it is possible to work something out in LiveCode and not have to worry about LCB at all.

Is THIS what you mean?
-
Screen Shot 2022-09-29 at 2.16.09 PM.png
Screen Shot 2022-09-29 at 2.16.09 PM.png (7.63 KiB) Viewed 7005 times
-
Or this?
-
Screen Shot 2022-09-29 at 2.17.16 PM.png
Screen Shot 2022-09-29 at 2.17.16 PM.png (4.25 KiB) Viewed 7004 times
-
Screen Shot 2022-09-29 at 2.18.24 PM.png
Screen Shot 2022-09-29 at 2.18.24 PM.png (4.39 KiB) Viewed 7000 times
-
Oh, and while I'm "here" could someone tell me what the supposed functionality of the second one is meant to be? 8)

Re: create widget

Posted: Thu Sep 29, 2022 12:44 pm
by Samuele
The second one. something like this
Immagine 2022-09-29 134448.jpg

Re: create widget

Posted: Thu Sep 29, 2022 12:46 pm
by Samuele
the ones you posted work only for apple devices, they're more good looking than the android ones...

Re: create widget

Posted: Thu Sep 29, 2022 12:56 pm
by Klaus
Samuele wrote:
Thu Sep 29, 2022 12:46 pm
the ones you posted work only for apple devices, they're more good looking than the android ones...
Nope! All widgets in LC work of course crossplatform, read, they look the same on all devices!

Re: create widget

Posted: Thu Sep 29, 2022 1:31 pm
by richmond62
I have a feeling that it should be amazingly easy to make those in LiveCode.
-
Screen Shot 2022-09-29 at 3.46.22 PM.png
-

Re: create widget

Posted: Fri Sep 30, 2022 2:51 am
by bobcole
Richmond62: Thanks for posting your Switcher stack.

Just for fun I put together a switch control consisting of simple LC graphics grouped together.
By using LC graphics, I was able to change colors, inner glow, add labels ("ON" and "OFF"), move the switch from side to side, etc.
The script is contained in the group so the user can click anywhere in the group to toggle the switch.
Here is my simple stack for your use, modifications or enhancements. I haven't tried to write a resize script.
This was an interesting project.
Enjoy,
Bob

SwitcherBC.livecode.zip
(8.44 KiB) Downloaded 145 times

Re: create widget

Posted: Fri Sep 30, 2022 7:24 am
by richmond62
Well, Bob, your thing is far more sophisticated than my Q-and-D graphic with two backGroundPatterns.

Mind you, mine involved all of 5 minutes work.

The point (which I have tried to make several times) is that, with LiveCode at least, having to learn LCB
should be redundant as 99% of things should be doable in LiveCode itself.

And, another advantage about doing things in LiveCode instead of LCB is that those things are more
easily modified by other LiveCode users.

Re: create widget

Posted: Fri Sep 30, 2022 8:54 am
by bn
Here is an old stack showing switchbuttons and sliders which can be heavily (maybe too much so) configured.


Kind regards
Bernd


customSlider_0_10.livecode.zip
(22.5 KiB) Downloaded 149 times

Re: create widget

Posted: Fri Sep 30, 2022 9:00 pm
by bobcole
Bernd:
Your stack is BRILLIANT!
Thank you for posting it.
Bob