Jump to content

Example of how to make an editable diagram inside a front panel, like the statechart dialogs

Recommended Posts

Disclaimer: This technique makes use of multiple private properties/methods (one of which is optional), as well as some private menu options accessible through the INI key "enableSecretPopups=True". I believe this use of them is safe (in fact I'm pretty sure RestrictLRGrowMove is being used for its specific intended purpose!) but as I don't work for NI, I can't make any guarantees.


I know that many of LabVIEW's dialogs are implemented as VI's, and I was curious if the statechart module's state configuration dialog was implemented in this way as well. Sure enough, it was, which meant it was possible to create an editable block diagram as part of a VI's front panel. It didn't take long to figure out that the input/output nodes on the left and right were really unbundle/bundle by name nodes, as it was literally as easy as putting the mouse over one and looking at the context menu! I didn't at first know how it prevented them from moving left and right or being copied to another VI, however. I realized it had something to do with the object's flags through experimenting in Heap Peek. Then I found the private property called "RestrictLRGrowMove", which had this exact effect.


So yeah, this is basically just a VI I created as a demonstration of this technique. It's possible to put a block diagram in a subpanel through a scripting method, and it's also possible to enable editing in that subpanel through a private property or hidden menu item. Of course, the latter means this isn't officially supported by NI, but it's still an interesting technique. Perhaps someday it will have official support.


And if you're wondering why the unbundle/bundle nodes only show the text, it's actually very simple: there is no way to scroll in the subpanel unless scroll bars are enabled, and the rest of it is simply out of the viewable portion! The subVI that generates the embedded VI is kind of messy, but I put a step-by-step explanation of how it's generated on its block diagram as well for that reason.




Subpanel Diagram Example.zip

Link to post

This is pretty neat.  One thing I noticed right away is that Auto-Tool has to be on.  If you try tabbing through the tools your tab is intercepted by the front panel and your cursor moves from control to control.  This also affects things like QuickDrop and the Clean-up shortcuts.

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.