Mapping handler dependencies

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

AndyP
Posts: 615
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

Re: Mapping handler dependencies

Post by AndyP » Mon Mar 13, 2023 3:04 pm

Hi Andreas,

What a useful tool, thank you for sharing.

I have two suggestions.

1. The fixed height is too high, a lot of users will have screen resolutions with a max 1024 or 1080 heights.
2. Being able to output a report would be useful.

Anyway, thanks again, having lots of fun looking at past projects!
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 261
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: Mapping handler dependencies

Post by SWEdeAndy » Mon Mar 13, 2023 9:40 pm

Thanks Andy, that's great feedback! :D

You are quite right about the height thing. I've added some responsiveness to the resizing now, so the user can adjust to any size (minimum 800 though). All the sections will expand/contract proportionally. I may add width adjustment too, although that is not as useful here I think.

Indeed, outputting a report is a good idea. What form do you think would be useful? Just a text file maybe, where the treeviews are printed the way the handler hierarchy field is now? Or as a pdf?

I've also thought about some kind of more graphical representation of the relations, but I'm not sure if that is feasible, or useful?

Edit: Latest version is now here, with fully responsive design and simple report export: https://github.com/wheninspace/WIS_ScriptDepedencies
Last edited by SWEdeAndy on Thu Mar 16, 2023 10:27 pm, edited 1 time in total.
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 261
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: Mapping handler dependencies

Post by SWEdeAndy » Thu Mar 16, 2023 10:20 pm

And just to get a forum notification out to interested parties :), here we go again:
https://github.com/wheninspace/WIS_ScriptDepedencies
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 261
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: Mapping handler dependencies

Post by SWEdeAndy » Thu Aug 10, 2023 3:08 pm

A major feature addition to WIS_ScriptDepedencies: View your handler flows in an interactive flowchart!
Again the wonderful browser widget has opened a portal to an entire coding galaxy out there, bringing amazing features right into LiveCode! :D

Download the latest version of WIS_ScriptDepedencies here:
https://github.com/wheninspace/WIS_Scri ... ses/latest

For those new to it: Open the stack and then click a + button to load one or more stacks to be analysed here:
ScD1.png
ScD1.png (14.05 KiB) Viewed 89500 times

Then select them in the list and hit the Start mapping button and when it's done, click the new Create flowchart button towards the bottom-right:
ScD2.png
ScD2.png (2.31 KiB) Viewed 89500 times

The flowchart is presented in a substack that you can drag to resize. Big flowcharts tend to get small font sizes, so a large screen is to prefer.
Click on handler names in the chart to have them highlighted back in the main stack.
Last edited by SWEdeAndy on Fri Aug 11, 2023 3:27 pm, edited 1 time in total.
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

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

Re: Mapping handler dependencies

Post by bn » Thu Aug 10, 2023 6:09 pm

Hi Andy,
A major feature addition to WIS_ScriptDepedencies: View your handler flows in an interactive flowchart!
That is out of this world. The flow-chart is unbelievable.
Actually the rest of the stack is also.
Bravo.

Thank you very much.

Kind regards
Bernd

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 261
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: Mapping handler dependencies

Post by SWEdeAndy » Thu Aug 10, 2023 8:11 pm

bn wrote:
Thu Aug 10, 2023 6:09 pm
That is out of this world. The flow-chart is unbelievable.
Actually the rest of the stack is also.
Bravo.
Thank you, Bernd! :D I'm happy you like it! It is indeed rather mind-blowing!
It's so fascinating to load stacks from different people (not just my own) and really SEE the various coding styles and principles used! It blooms like flowers!

The only thing now that makes me unhappy is that I can't get it to work on Windows. It just doesn't load the mermaid library through the geriatric CEF browser... Hopefully it will be upgraded in a coming LC10 dp or something.
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

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

Re: Mapping handler dependencies

Post by stam » Thu Aug 10, 2023 9:56 pm

Very nice tool and very well done, thank you Andreas.

Having occasional issues with crashes - happens in the colorizeStackList handler (cannot find stack). Seems to only happen with some scriptOnly stacks, while other scriptOnly stacks and normal stacks seem fine, which is weird... I'll look into a bit more and see if I can find a reproducible recipe/explanation.

Had a quick look at the graph and it is super smooth! But doesn't seem to include getProp/setProp handlers?

Otherwise very slick tool - I am sure this will be massively helpful to many here... thank you for sharing!

Stam

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9663
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Mapping handler dependencies

Post by dunbarx » Thu Aug 10, 2023 10:11 pm

Fun stuff, but I have a question, likely the result of ignorance.

I made a simple stack with a couple of handlers (mouseUp, mouseEnter, and a few others) in a button. But no matter what I do, when I try to make a flowchart, I can only get the mouseUp handler as the "root" of the resulting flowchart. I tried selecting the other handlers everywhere.

If I comment the "mouseUp" handler, I then get a different one, and am then still unable to select any of the others. The one selected is not next in handler order, nor did I do anything to mark it specially.

Craig

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 261
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: Mapping handler dependencies

Post by SWEdeAndy » Fri Aug 11, 2023 7:49 am

stam wrote:
Thu Aug 10, 2023 9:56 pm
Very nice tool and very well done, thank you Andreas.

Having occasional issues with crashes - happens in the colorizeStackList handler (cannot find stack). Seems to only happen with some scriptOnly stacks, while other scriptOnly stacks and normal stacks seem fine, which is weird... I'll look into a bit more and see if I can find a reproducible recipe/explanation.
Thanks a lot for your kind words, Stam! :D
Concerning the crashes (as in LC crashing or just an error message?) I'd be very interested in finding the cause and fixing it. If you could isolate the 'offending' stacks to see if they have something in common that would be great. Any special chars in the name or something?

I might rework the adding of stacks functionality a little anyway. It currently adds all of the selected stacks to 'the stackFiles', which immediately loads them into memory. But if you add a whole folder, and it has more than one version of the same mainstack then you get the classic name space clash ("Another stack with that name is already open..." etc). So, a better way would be to only load the stacks actually selected for analysis in the list.
Adding the possibility to drag'n'drop files into the UI is probably more intuitive. I'll put that on my list. :)
Had a quick look at the graph and it is super smooth! But doesn't seem to include getProp/setProp handlers?
Hmm, well it should. I'll check what goes wrong there.
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 261
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: Mapping handler dependencies

Post by SWEdeAndy » Fri Aug 11, 2023 8:34 am

dunbarx wrote:
Thu Aug 10, 2023 10:11 pm
Fun stuff, but I have a question, likely the result of ignorance.

I made a simple stack with a couple of handlers (mouseUp, mouseEnter, and a few others) in a button. But no matter what I do, when I try to make a flowchart, I can only get the mouseUp handler as the "root" of the resulting flowchart. I tried selecting the other handlers everywhere.

If I comment the "mouseUp" handler, I then get a different one, and am then still unable to select any of the others. The one selected is not next in handler order, nor did I do anything to mark it specially.
Well, the tool lists every existing handler in your stack, but the flowchart only shows the ones relevant for 'downward' relations.

The flowchart is generated based on what's in the Handler dependency stats field (the one at bottom-left). Selecting a handler (currently) has no effect on the flowchart generation, but filtering the Handler dependency stats field has. The flowchart may still include more handlers than visible in the filtered field, but the basis will be the ones visible, the flowchart showing all handlers leading 'up' to them.

Here's a simple stack/button I made and the resulting flowchart:
ScD.png
The handler 'IhaveNoRelation' doesn't call and isn't called, so it is ignored by the flowchart.
If the field is filtered to only show 'doStuff' and 'doOther', the flowchart would still look the same, since they have 'subs' calling them.
If the field is filtered to only show mouseUp and mouseEnter, the flowchart will be empty as they have no 'subs' calling them.

In other words, the design principle of the tool is not to start at a root and go up - it is to start at the top and find the roots.
To find all the dependencies. And then display them.
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9663
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Mapping handler dependencies

Post by dunbarx » Fri Aug 11, 2023 1:48 pm

OK, that works now.

A small thing, and I am infamous for having such small things, I find that if I modify the handlers in the small stack I made, unless I save twice, the stack is disabled in the answer file dialog that appears to select the stack of interest in section 1, "List of stacks that can be selected..."

Odd.

Craig

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 261
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: Mapping handler dependencies

Post by SWEdeAndy » Fri Aug 11, 2023 2:34 pm

dunbarx wrote:
Fri Aug 11, 2023 1:48 pm
A small thing, and I am infamous for having such small things, I find that if I modify the handlers in the small stack I made, unless I save twice, the stack is disabled in the answer file dialog that appears to select the stack of interest in section 1, "List of stacks that can be selected..."
I've noticed that too, but that seems to be a MacOS/LC problem, because I get this often when just doing "Open stack..." in LC, and sometimes other apps I think. What I often see is that everything is dimmed (even folders), as if unselectable, but then the appropriate files (such as LC stacks) turn out to be selectable after all, if you just click them anyway. If you go into a folder, then back up a level again, then everything that should be selectable suddenly is, and the rest is dimmed. So it appears MacOS lags behind sometimes in updating what should appear dimmed/selectable in a file dialog.

In the ScriptDep tool, you don't need to reselect your stack every time you've made a change though. You don't even have to save, actually - just hit the Start mapping... button again and it will go through the stacks (selected in the list) anew.
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

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

Re: Mapping handler dependencies

Post by jacque » Fri Aug 11, 2023 6:14 pm

What I often see is that everything is dimmed (even folders), as if unselectable, but then the appropriate files (such as LC stacks) turn out to be selectable after all, if you just click them anyway.
I see that all the time, even in Finder. It started happening a couple of OSX versions ago and it makes me crazy. It isn't the stack or LC, it's the OS. I'm not sure why it hasn't been fixed yet, it's been going on for so long.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9663
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Mapping handler dependencies

Post by dunbarx » Fri Aug 11, 2023 8:06 pm

Yow.

I will start to try selecting these dimmed files and folders. I just assumed they were unavailable...

Craig

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 261
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: Mapping handler dependencies

Post by SWEdeAndy » Sun Aug 13, 2023 2:40 pm

So, the latest version now has a workaround so that Windows users also can see the magic flowchart!

https://github.com/wheninspace/WIS_Scri ... ses/latest

1.0.6 (13 Aug 2023)
- Enhancement: Flowchart can now be exported to HTML file and launched in external browser. This is currently the only option for Windows users. Mac users get the in-stack interactive flowchart per default, but can choose to create an HTML file by pressing shift while clicking the Output flowchart button
- Enhancement: Handlers that unambiguously reside in one single stack/card/control script can be grouped together in the flowchart view. This function can be toggled on/off
- Enhancement: Possibility to filter out and filter in certain handlers. Filtering out some handlers, such as ”log” or mouse events can make some flowcharts less crowded
- Enhancement: The stack now looks for newer versions of itself on startup
- Other minor fixes
Andreas Bergendal
Independent app and system developer
WhenInSpace: https://wheninspace.se

Post Reply

Return to “Talking LiveCode”