Nested Data Grid Behaviors

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bwmilby
Posts: 438
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Nested Data Grid Behaviors

Post by bwmilby » Mon Jul 30, 2018 4:13 am

We had a thread going on the Use List about how to get a behavior between the Data Grid group and the DG library. It turns out that the way the library code was written, attempting to do this broke the Data Grid. A bug report was submitted and a fix has been proposed. This is great for those of us who are on LC9, but won't help anyone using LC8 if they would like this behavior. I've posted a demo stack on GitHub that shows you how to do this on either version (and it may work on earlier versions too).

Why? If you wanted to use a behavior to replace or add to an existing DG handler, you would not be able to without this mod. You could always put the code in the DG group itself, but then you would need to duplicate it for each DG that you wanted to use the same code. You could chain it to the end (after the library code), but then it would impact every DG in the app (which may or may not be an issue).

https://github.com/bwmilby/lc-misc/tree ... DGBehavior

Image

The README on GitHub also links to the discussion thread, the PR, and the bug report.
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

Monox18
Posts: 118
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

Re: Nested Data Grid Behaviors

Post by Monox18 » Tue Nov 16, 2021 12:10 am

Hi Brian,

I came across this post today when trying to set up custom DG behaviours. I tested the demo stack and it works well in the IDE. I also compiled to Windows standalone but it doesn't work. I tried as well modifying the behaviorsdatagridbuttonbehavior.livecodescript file in the LC installed folder, so that the preOpenStack code is no longer necessary, but still doesn't work. Maybe there's a proper way of modifying an IDE stack? Any ideas of how to make this work in a Standalone?

I suppose this demo was intended for IDE only, never for standalone, and to be merged. The pull request was never merged and now that they archived the repository it is unlikely that they will merge it... :/
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

bwmilby
Posts: 438
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: Nested Data Grid Behaviors

Post by bwmilby » Wed Nov 17, 2021 5:46 am

I’ve never actually tried to build a stand alone that uses the code, so I’m not positive about the steps. But, if you updated the script in the LC installed on your machine, that same code should be brought into your compiled app. I would need to play with it some.

If it doesn’t make it into version 10, then I could update the stack if needed to keep it working.
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

Monox18
Posts: 118
Joined: Tue Nov 25, 2014 9:48 pm
Location: Deggendorf, Germany

Re: Nested Data Grid Behaviors

Post by Monox18 » Wed Nov 17, 2021 12:17 pm

I gave it a second try today with a fresh mind and quickly fixed it. I noticed your original stack doesn't have the typical "Data Grid Templates 1637146130251" substack autogenerated when dragging a Datagrid for the first time. I deleted your DG, dragged a new one, the substack was generated, put the behavior, compiled again and this time It worked in a Standalone. No need to edit the installed LC stacks. So the preOpenStack code does indeed work in standalones.

Here's the updated one, also saved as the recent LC 9 version.
NestedDGBehavior2.rar
(8.29 KiB) Downloaded 95 times
I never thought I could edit an IDE stack on a preOpenStack. That opens up some possibilities, especially when trying to find a bug workaround. Thanks mate !
Monox
Developing a Cyber Physical System.
https://www.monoxware.com/

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”