Palette stack of Custom Controls
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 854
- Joined: Wed Nov 04, 2009 11:41 am
- Location: Gunthorpe, North Lincs, UK
Palette stack of Custom Controls
Hi,
The recent Livecode Lockdown video played a lecture given by UI expert Scott Rossi. His talk was about behaviours but in it he showed a set of custom controls for iOS that he use to maintain. These custom controls were displayed in a floating stack and the controls could be dragged into an open project stack for use.
I would like to create my own version of this toolbox palette and wonder if there is a common approach ?
I'm thinking of placing my actual custom controls on sub stacks which are hidden from view. The toolbox will just contain a number of images of the controls or perhaps icons that convey what the control does. Then the user (me) drags the image/icon from the toolbox onto a second stack and this causes the hidden control to be copied.
Is the above a sensible plan ?
The recent Livecode Lockdown video played a lecture given by UI expert Scott Rossi. His talk was about behaviours but in it he showed a set of custom controls for iOS that he use to maintain. These custom controls were displayed in a floating stack and the controls could be dragged into an open project stack for use.
I would like to create my own version of this toolbox palette and wonder if there is a common approach ?
I'm thinking of placing my actual custom controls on sub stacks which are hidden from view. The toolbox will just contain a number of images of the controls or perhaps icons that convey what the control does. Then the user (me) drags the image/icon from the toolbox onto a second stack and this causes the hidden control to be copied.
Is the above a sensible plan ?
best wishes
Skids
Skids
-
- Livecode Opensource Backer
- Posts: 9446
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Palette stack of Custom Controls
Well, if you're looking for a subjective opinion that is certainly one way to obtain one.
The first question would be; "What for?"a set of custom controls for iOS
I would only be looking to make a palette with custom controls for a programming IDE . . .
So, is that what you are speiran after with this on iOS?
-
- Posts: 854
- Joined: Wed Nov 04, 2009 11:41 am
- Location: Gunthorpe, North Lincs, UK
Re: Palette stack of Custom Controls
Ah, I have confused - sorry.
Over the years I have created some of my own custom controls and I am thinking that it would be useful if I put them all together in one place to make them simpler to find. So this will just be for use by me in the IDE and it has nothing specific to do with Mobile, its just what Mr. Rossi demonstrated.
I appreciate that I could just use copy and paste my controls but in the talk Mr. Rossi had a working toolbox that allowed objects to be dragged to a second stack and dropped. So I thought "how is that done" which led to my question?
Over the years I have created some of my own custom controls and I am thinking that it would be useful if I put them all together in one place to make them simpler to find. So this will just be for use by me in the IDE and it has nothing specific to do with Mobile, its just what Mr. Rossi demonstrated.
I appreciate that I could just use copy and paste my controls but in the talk Mr. Rossi had a working toolbox that allowed objects to be dragged to a second stack and dropped. So I thought "how is that done" which led to my question?
best wishes
Skids
Skids
Re: Palette stack of Custom Controls
Only one guy in Bulgaria!
Since iOS only supports ONE window/stack at a time it was more than clear that you mean a palette for development.
So, yes, this is a good plan!
-
- Livecode Opensource Backer
- Posts: 9446
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Palette stack of Custom Controls
-
- Posts: 854
- Joined: Wed Nov 04, 2009 11:41 am
- Location: Gunthorpe, North Lincs, UK
Re: Palette stack of Custom Controls
Ooo Eck, could be a good time for a 2m distant walk
I shall have a play with drag and drop stuff and see how lost I get....
I shall have a play with drag and drop stuff and see how lost I get....
best wishes
Skids
Skids
-
- VIP Livecode Opensource Backer
- Posts: 7257
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Palette stack of Custom Controls
I've never tried it, but I believe the IDE creates a small temporary stack with an image of the control in it (or maybe the control itself.) The stack follows the movement of the cursor and when the mouse goes up it creates a copy of the control on the target stack and deletes the temporary stack.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Livecode Opensource Backer
- Posts: 9446
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Palette stack of Custom Controls
Popping across to the Metacard tools stack I extracted the substack "Tools" from it
and found this:
What particularly interests me is the line 'newTool' as I cannot locate a script 'newTool' anywhere.
and found this:
Code: Select all
on openStack
insert script of button "MenuButton" of stack "MetaCard Menu Bar" into front
insert script of button "newobj" of stack "MetaCard Menu Bar" into back
newTool
end openStack
Re: Palette stack of Custom Controls
Jacque, you are correct in Rev/Lc vers past 2.2 (I believe that started around 2.7/8, which is where the 'modern' tool palette starts). Prior to that, in vers. 1.1 to 2.(2? 3?) you clicked on the object you wanted to use, and it is much like Richmond says goes on in Mc. The main differences between Mc's way and Rev 1.1 - 2.2.x is that Mc had you draw the control, Rev actually used a template setup where the control was a default size when you 'placed' it.
-
- Posts: 854
- Joined: Wed Nov 04, 2009 11:41 am
- Location: Gunthorpe, North Lincs, UK
Re: Palette stack of Custom Controls
I have a working stack based on an old demonstration stack that I found. It needs a tidy up before I dare post it here and I'm just off for some shut eye.
So it will have to be tomorrow.
So it will have to be tomorrow.
best wishes
Skids
Skids
Re: Palette stack of Custom Controls
Although this references a 'mobile IDE' design, I thought it might be of some use in this thread, as many of the ideas presented should work out well in your case as well. Neil Roger really did an excellent job of detailing some of the thoughts and code that goes into such things.
-
- Posts: 854
- Joined: Wed Nov 04, 2009 11:41 am
- Location: Gunthorpe, North Lincs, UK
Re: Palette stack of Custom Controls
Hi All,
Here is a working stack that could be used to store any custom controls you have created. It is based on and uses the same technique that Peter Haworth employed in a demo he created some years ago.
I have updated and added to the code base. The palette is quite large owing to the long text instructions so for general use this should be deleted and the stack reduced in size.
The tricky part is moving behavior buttons to the target stack and re-assigning then to the newly copied custom control. (Note that this also an issue with images used by custom controls and the control should locate its own images when it starts)
So any volunteer beta testers?
Here is a working stack that could be used to store any custom controls you have created. It is based on and uses the same technique that Peter Haworth employed in a demo he created some years ago.
I have updated and added to the code base. The palette is quite large owing to the long text instructions so for general use this should be deleted and the stack reduced in size.
The tricky part is moving behavior buttons to the target stack and re-assigning then to the newly copied custom control. (Note that this also an issue with images used by custom controls and the control should locate its own images when it starts)
So any volunteer beta testers?
best wishes
Skids
Skids
-
- VIP Livecode Opensource Backer
- Posts: 4016
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Palette stack of Custom Controls
Hi Simon,
that is a very neat example stack. Thank you.
For behavior buttons that are embedded in a grouped control I use the "newGroup" message that is sent to a group when it is created.
from the dictionary
Sent to a new group right after it's created.
Pseudocode for the group script (should work)
You could additionally trap the "openControl" or "preOpenControl" message that is sent to grouped controls to set the behavior. This is in case the stack is renamed. That way the behvavior should not break.
Kind regards
Bernd
that is a very neat example stack. Thank you.
For behavior buttons that are embedded in a grouped control I use the "newGroup" message that is sent to a group when it is created.
from the dictionary
Sent to a new group right after it's created.
Pseudocode for the group script (should work)
Code: Select all
on newGroup
set the behavior of me to the long id of button "myBehaviorButton" of me -- don't forget "of me" in case you have another button "myBehavior"
end newGroup
Kind regards
Bernd
-
- Posts: 854
- Joined: Wed Nov 04, 2009 11:41 am
- Location: Gunthorpe, North Lincs, UK
Re: Palette stack of Custom Controls
Hi Bernd,
Great to hear from you and thanks for your comments and suggestions. I shall investigate the handlers you mention, the newgroup handler is especially interesting.
My aim was to experiment with drag and drop having seen a talk by Scott Rossi and to produce something that is both useful and that I might understand in a years time.
I'm of two minds where code should be placed in grouped controls and have tried various options with half finished attempts. Its a pity that Livecode does not provide a slightly more robust custom control construct but I suppose they would remind me that there is always Livecode Builder.
I think I am tending towards using an embedded behavior button. This will mean that all the code resides inside the group yet it remains simple to reassign multiple copies of a group control towards a single behavior button if desired. Adopting this approach will mean that I can use the newgroup handler as you describe and there should be less chance of the group becoming separated from its behavior button
Do you think others might find the stack of use if I posted it somewhere else on the web?
best wishes
Simon
Great to hear from you and thanks for your comments and suggestions. I shall investigate the handlers you mention, the newgroup handler is especially interesting.
My aim was to experiment with drag and drop having seen a talk by Scott Rossi and to produce something that is both useful and that I might understand in a years time.
I'm of two minds where code should be placed in grouped controls and have tried various options with half finished attempts. Its a pity that Livecode does not provide a slightly more robust custom control construct but I suppose they would remind me that there is always Livecode Builder.
I think I am tending towards using an embedded behavior button. This will mean that all the code resides inside the group yet it remains simple to reassign multiple copies of a group control towards a single behavior button if desired. Adopting this approach will mean that I can use the newgroup handler as you describe and there should be less chance of the group becoming separated from its behavior button
Do you think others might find the stack of use if I posted it somewhere else on the web?
best wishes
Simon
best wishes
Skids
Skids
-
- VIP Livecode Opensource Backer
- Posts: 4016
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Palette stack of Custom Controls
I find it a very useful stack and think you could upload it to Livecodeshare for all to see. You have to register for that I think.Simon Knight wrote: ↑Fri Jun 19, 2020 3:59 pmDo you think others might find the stack of use if I posted it somewhere else on the web?
best wishes
Kind regards
Bernd