Palette stack of Custom Controls

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Simon Knight
Posts: 854
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Palette stack of Custom Controls

Post by Simon Knight » Mon Jun 22, 2020 12:08 pm

I have worked on the stack over the weekend and settled on version 1.2. It needs some third party testing but I hope I have caught all the bugs.

It started out as an exercise in drag and drop from a Livecode palette but quickly morphed into trying to keep track of object references. These cause issues because neither names or IDs are unique across multiple stacks. If you do use this stack in its present form, no reason not to, I advise that you ensure that your behavior buttons are given unique names.

The stack has only been tested on an Apple Mac but should work on all desktops as an IDE plug-in. I will be posting it to Livecode Share once I am able to create an account.

Any comments, observations or results of testing welcomed.
Attachments
CustomrControlPaletteV1-2.livecode.zip
A palette to hold your custom controls (groups)
(120.01 KiB) Downloaded 177 times
best wishes
Skids

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4002
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Palette stack of Custom Controls

Post by bn » Mon Jun 22, 2020 2:54 pm

Hi Simon,

thanks for the update.

In short testing it works flawlessly. Some behaviors are broken in card "DragSource". (they are displayed in red in the Properties Inspector in current versions of LC)

Another example how to control controls in a separate stack dynamically via behaviors is "bnGuides" on Livecode Share. It made me dizzy when doing it.

Kind regards
Bernd

Simon Knight
Posts: 854
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Palette stack of Custom Controls

Post by Simon Knight » Mon Jun 22, 2020 3:05 pm

Hi Bernd,

Yes I was left wishing that the property inspector would show ID numbers in addition to names (I did search but found no option to switch them on). I'll take a look at your stack to see how you solved the issues.

best wishes

Simon
best wishes
Skids

Simon Knight
Posts: 854
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Palette stack of Custom Controls

Post by Simon Knight » Mon Jun 22, 2020 3:26 pm

Bernd,
Some behaviors are broken in card "DragSource". (they are displayed in red in the Properties Inspector in current versions of LC)
Please will you send me more details or a screen shot as I don't see any problems on my version.

best wishes

Simon
best wishes
Skids

Simon Knight
Posts: 854
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Palette stack of Custom Controls

Post by Simon Knight » Mon Jun 22, 2020 3:27 pm

oops please ignore my previous - I've spotted them - v1.3 next.

Simon
best wishes
Skids

Simon Knight
Posts: 854
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Palette stack of Custom Controls

Post by Simon Knight » Mon Jun 22, 2020 3:58 pm

Serves me right for starting with a stack I found on the forum: it had a couple of 1 by 1 fields lurking off screen. Mind you the two reds on the documentation stack were all my own doing.

Here is version 1.3. there should not be any red warnings and I have made the documentation stack a palette so that it may be viewed while in edit mode.

Simon
Attachments
CustomrControlPaletteV1-3.livecode.zip
(119.68 KiB) Downloaded 192 times
best wishes
Skids

Simon Knight
Posts: 854
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Palette stack of Custom Controls

Post by Simon Knight » Mon Jun 22, 2020 4:29 pm

Well I think I have posted v1-3 on the Sample Stacks site. It may be found by searching for "User Tools Palette".
best wishes
Skids

PaulDaMacMan
Posts: 627
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: Palette stack of Custom Controls

Post by PaulDaMacMan » Tue May 09, 2023 7:32 pm

Just found this thread, after working on similar stuff for the past 1-2 months :(
Anyway... the trick to doing cross-stack scripts seems to be to monitor either topStack or the mouseStack (need a front script for that) then when the script needs to do stuff, like get/set the fore/back colors of a control, on the other stack, you set the 'defaultStack' to that stack. defaultStack seems to work s a bit like the 'focus' syntax but for stack windows (or more accurately like the 'keyWindow' property in Apple's ObjC).

Your can use selectedObjects to get a list any selected controls, if that list is empty then you can check the selectedChunk to see if some text is selected (if your'e interested in the text, which I currently very much am), you can check 'the selectedImage' to see if the user in in pixel-image-paint mode. If you store the selections in some container/variable you can then combine them in your scripts (exam.: tSelectedChunk & " of " & tSelectedObj).

I won't go into the whole dragImage thing for drag-n-drop stuff because the demo stacks here and on livecodeshare (you could look at the IDE's tools stack too) pretty much cover that topic, with examples of drag drop behavior to insert into front script.

You can also subscribe your stack to IDE messages from the list returned by revIDEMessages(), in particular: revIDESubscribe "ideSelectedObjectChanged".

The tricky thing I'm trying now is to do cross-stack text editing via script, which in my testing stack I'm checking any non-empty selectedChunk using the 'on idle' syntax (with an idleRate set) but that's probably not optimal and will likely change it to an 'on ideMouseMove' from the revIDE library/subscribed messages. Text editing is done in 'browse tool' mode versus edit mode, so the selectedObjs is empty with that tool.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

Simon Knight
Posts: 854
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Palette stack of Custom Controls

Post by Simon Knight » Tue May 09, 2023 8:51 pm

Thanks - I think ! 2020 seems along time ago.
best wishes
Skids

PaulDaMacMan
Posts: 627
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: Palette stack of Custom Controls

Post by PaulDaMacMan » Wed May 10, 2023 5:12 am

Simon Knight wrote:
Tue May 09, 2023 8:51 pm
Thanks - I think ! 2020 seems along time ago.
Probably worth noting you could just store your reusable group objects in a library in the IDE's Object Library, which I've spent some time implementing drag-drop-to-place (for revImages too -- which is the same stack). For some reason it took me a long time to actually start using that bit to store some objects, now I'm find it very useful (specially after some modifications).

I'm basically working on mostly graphics things right now, trying to turn the IDE into a more QuarkXpress (v3 the best version)-like setup by building a text / tools palette loosly modeled on Quark (v3's) measurements palette, and changed command-keys to be more standard page-layout key commands... command+shift+C = center the selectedChunk, instead of Edit Card Script, Command-shift+ +/- to scale text up/down, etc.

I've also made a Color Swatch palette that can use different color sets, engine named colors or custom set (which can use click or drag-drop for applying)
TextPal.jpg
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9386
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Palette stack of Custom Controls

Post by richmond62 » Wed May 10, 2023 9:16 am

Thanks for that code: when I find some time I'll work my way through those SVG stacks of mine and
make things possible to drag-n-drop the icons.

Simon Knight
Posts: 854
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Palette stack of Custom Controls

Post by Simon Knight » Fri May 12, 2023 7:02 am

Useful tools.

If I remember my own efforts were aimed at simplifying the use of custom controls built using livecode attempted partly in response to all the encouragement at the time to use Livecode Builder.

Simon
best wishes
Skids

PaulDaMacMan
Posts: 627
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: Palette stack of Custom Controls

Post by PaulDaMacMan » Sat May 13, 2023 12:35 am

richmond62 wrote:
Wed May 10, 2023 9:16 am
Thanks for that code: when I find some time I'll work my way through those SVG stacks of mine and
make things possible to drag-n-drop the icons.
I've already done that, well like everything else it's a work in progress, it reads IconSVG library's arrays, has drag to place, and a simple export to SVG file.
Screenshot 2023-05-12 at 7.27.16 PM.jpg
SVG_Icons_Browser.rev.zip
(37.09 KiB) Downloaded 67 times
If you open the stack with the Alt/Option Key held down, then the stack will be opened in editable non-palette topLevel mode.
Last edited by PaulDaMacMan on Sat May 13, 2023 3:02 am, edited 4 times in total.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

PaulDaMacMan
Posts: 627
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: Palette stack of Custom Controls

Post by PaulDaMacMan » Sat May 13, 2023 12:40 am

PaulDaMacMan wrote:
Sat May 13, 2023 12:35 am
richmond62 wrote:
Wed May 10, 2023 9:16 am
Thanks for that code: when I find some time I'll work my way through those SVG stacks of mine and
make things possible to drag-n-drop the icons.
I've already done that, well like everything else it's a work in progress, it works reads IconSVG library's arrays, has drag to place, and a simple export to SVG file:

SVG_Icons_Browser.rev.zip
Although, your files were Image controls with Drawing Library's 'compiled SVG' format data in them so they won't show up in this stack's listings, but you could convert them to Image Libraries (which Ive also enabled drag to place in), just by renaming them to 'revLibWhatever' and placing them in the appropriate folder.

Here's the modified revImageLibrary with drag-to-place enabled for replacing the one in the IDE with:
revImagelibrary.rev.zip
(35.68 KiB) Downloaded 70 times
There were some other issues with it I was trying to deal with, like previously making a new Object library would make the new library stack but wouldn't allow you to add items to the new library stack (you could only add to the existing revObjectLib. This version allows you to work with multiple object libraries.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9386
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Palette stack of Custom Controls

Post by richmond62 » Sat May 13, 2023 9:56 am

Possibly.

Although, frankly, I would far rather keep my 'Gift' stacks as independent entities than 'fold them into the cake mix'.

Post Reply

Return to “Talking LiveCode”