This will be a short post on a minor annoyance with putting together a dynamic UI in LabVIEW. I am currently building a multi-subpanel UI with Stream and my simple actor implementation and was annoyed with the difficulty of registering for events on the individual panes in my UI. This annoyance is rooted in the fact that I neglected to label my panes as they were created. So I wrote a very simple little tool for identifying and labeling populated panes.
For context, I am putting together a resizable dynamic UI where I want to pop actors into and out of SubPanels based on user interaction. To accomplish this I put together a UI View Controller Actor whose only job is to handle top level UI scaling and SubPanel ownership, which necessitated the creation of multiple Panes through the use of splitters. Here is a little demo.
In the demo the white areas are subpanels where actor UI's will be visible at run time. In the middle of the screen you can see the hamburger control that allows the user to slide the leftmost subpanels left or right. In order to make sure that the hamburger was always centered vertically in its pane I had to detect a pane resize, which required that I know the pane name. Since I neglected to name the panes as I created them, and was too lazy to delete the subpanels in each pane so that I could see it's label and change it I see this list when I try to add an event to the event structure.
My first thought was to drop some trash code on the block diagram to programmatically re-label the panes so that I could work with them in the event structure.
But this bit of code throws error 1073, "This property is writable only when the VI is in edit mode, or this method is available only when the VI is in edit mode."
So like any other software developer with an idea they want to try out, instead of moving my subpanels and changing the pane labels manually by right clicking on the splitterbars, I wrote a simple little tool.
There is nothing fancy about the pane re-labeling tool, it is so simple that I don't think it is worth my time to package it and give it away. Instead I will just show you screenshots of the block diagram so you can write it yourself in whatever version of LabVIEW you like.
Zooming in on the pane discovery bit before the while loop.
Counting the panel close event case, the event structure has three event cases. Here is a look at the handling of the doubleclick on the listbox.
And here is a look at the right click on the listbox.
In summary, this wouldn't have been a hard problem to solve manually but I figured I would write a short post on how I beat it to death with VI Server.
Jon McBee is the Founder and Managing Partner at Composed Systems and is a Certified LabVIEW Architect, Certified LabVIEW Embedded Developer, Certified TestStand Developer, an NI Certified Professional Instructor, a LabVIEW Champion, and a Certified ScrumMaster