Creating your own tools palate
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
Creating your own tools palate
Is it possible to create your own tools palate with fields of your own specification or design that you can then drag onto a card? How would one go about constructing such a thing? How would one make the objects drag and droppable from one card/palate to another?
Thanks
-- Mark
Thanks
-- Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
Re: Creating your own tools palate
Haven't dug into how they do it, but both Powertools by Mark W and droptools from Sons of thunder do this. Think droptools is free and you can dig through it (maybe?) as well as add your own tools to it. Haven't looked at either for a little bit though so not sure what restrictions there are on either and if yuo can see code but they're both great examples of what you're asking about.
Powertools is here. http://www.ahsoftware.net/PowerTools/
Droptools is here. http://droptools.sonsothunder.com/moreinfo.irev
Powertools is here. http://www.ahsoftware.net/PowerTools/
Droptools is here. http://droptools.sonsothunder.com/moreinfo.irev
Re: Creating your own tools palate
This is easy to do. There must be a dozen approaches.
Make a button. Put this into its script:
Now click on the button and hold the mouse down while you drag it away. Can you embellish this so that you are asked to rename it? You can make a palette with all the objects on it and do similar things. Can you do it a different way?
NOTE that the "last" keyword is not stable with groups, if you happen to try to do those. You have to set the templateGroup or use the "newGroup" message. See the dictionary. But all other objects can be referenced with "last".
Craig Newman
Make a button. Put this into its script:
Code: Select all
on mouseDown
clone me
repeat until the mouse is up
set the loc of the last btn to the mouseLoc
end repeat
end mouseDown
NOTE that the "last" keyword is not stable with groups, if you happen to try to do those. You have to set the templateGroup or use the "newGroup" message. See the dictionary. But all other objects can be referenced with "last".
Craig Newman
Re: Creating your own tools palate
Hi Craig,
That's the basis of another great way to heighten the user experience.
But how would i go about expanding on this to enable the clone to be dragged out of the bounds of the palette it was created, and dropped into a new card, in the same manner the tools in live-code work..?
I am guessing when you click & drag a tool ie: button in LC, It is cloned to another tiny palette without a toolbar. Is that correct..?
That's the basis of another great way to heighten the user experience.
But how would i go about expanding on this to enable the clone to be dragged out of the bounds of the palette it was created, and dropped into a new card, in the same manner the tools in live-code work..?
I am guessing when you click & drag a tool ie: button in LC, It is cloned to another tiny palette without a toolbar. Is that correct..?
Kind Regards
Gary
https://www.doobox.co.uk
Gary
https://www.doobox.co.uk
Re: Creating your own tools palate
Gary-
Yes, that's correct. Both PowerTools and DropTools use similar but slightly different approaches to the idea of creating a stack for the object so that you can drag it outside the normal LiveCode boundaries. Ken and I have also taken pains to ensure maximum compatibility between PowerTools widgets and DropTools controls, so that for the most part they should be interchangeable.
To be clever about creating a drag stack, you'd also want to set the windowshape of the drag stack to look like and have the size of the draggable object. You can look at the code of either DropTools or PowerTools (there's a trial version on revOnline) to see how the creation and dragging of objects is done, but I should warn you that there's a lot of work involved. The Bits themselves aren't that hard, but there are a lot of Bits.
Another approach is the one taken by MetaCard, where you click on an object in the palette to select the tool/object you're going to put into a stack, then draw a placement rectangle in the destination stack, and then copy the object to the destination and set its rect. This is a much easier thing to code, and you can take a look at the MetaCard stacks to see how it's done.
Yes, that's correct. Both PowerTools and DropTools use similar but slightly different approaches to the idea of creating a stack for the object so that you can drag it outside the normal LiveCode boundaries. Ken and I have also taken pains to ensure maximum compatibility between PowerTools widgets and DropTools controls, so that for the most part they should be interchangeable.
To be clever about creating a drag stack, you'd also want to set the windowshape of the drag stack to look like and have the size of the draggable object. You can look at the code of either DropTools or PowerTools (there's a trial version on revOnline) to see how the creation and dragging of objects is done, but I should warn you that there's a lot of work involved. The Bits themselves aren't that hard, but there are a lot of Bits.
Another approach is the one taken by MetaCard, where you click on an object in the palette to select the tool/object you're going to put into a stack, then draw a placement rectangle in the destination stack, and then copy the object to the destination and set its rect. This is a much easier thing to code, and you can take a look at the MetaCard stacks to see how it's done.
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
Re: Creating your own tools palate
Thanks for the suggestions guys... I'll get started with that and see how far I get.
-- Mark
-- Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS