Using external script only stack as behaviour

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

trevix
Posts: 960
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Using external script only stack as behaviour

Post by trevix » Fri Oct 07, 2022 11:01 am

You are right.
But I had to create my special group control buttons (because of how they should act), with a real button inside for assigning behaviour.
I started with a few and now they are by the hundreds...
I use the name of the group, to identify them, while the button inside is always something like "TheBtn".

Now I (finally) discovered my perfect (?) button, the universal button widget. Sigh...change everything again
https://github.com/revig/universal-button-widget
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

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

Re: Using external script only stack as behaviour

Post by jacque » Fri Oct 07, 2022 6:32 pm

That seems a bit excessive. A behavior is meant to control many objects that use the same script. How many controls are linked to each behavior? If there is only one control using a behavior, your life will be simpler if you put the script directly into the control.

Also, behaviors are generally assigned only once during development. Why do you need a button in each group to do that?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

stam
Posts: 2679
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Using external script only stack as behaviour

Post by stam » Fri Oct 07, 2022 8:35 pm

My issue with assigning buttons of a group as the group’s behaviour script is that every time you copy/paste the the group the ID of the button changes and the behaviour is broken. One way around it to to assign the behaviour in the group’s script with an on openControl and on resizeControl - but in practice this is a bit flaky and sometimes behaviours are broken anyway. I’ve now moved to creating substacks as behaviour stacks so within the same mainstack copy/pasting is without an issue - obviously copy/pasting between main stacks stacks requires the sub stack to be copied as well.

Regarding the massive list of buttons shown - with that many buttons it would seem much more logical assigning a substack as a behaviour; I also prefix these all (regardless of button or stack) with “behaviour” so they are easy to locate in the popup…

Post Reply

Return to “Talking LiveCode”