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
4 Comments
Dan
3/16/2017 10:26:29 am
Yeah, it's a little hard to get to the names. An alternative is to right click the splitter, and then go to the Pane's properties and change the name, or from the right click menu, you can show the label and edit there.
Reply
Jon McBee
3/16/2017 11:00:14 am
Right clicking the splitter to get to the pane properties window is definitely the right answer, for some reason this thought never crossed my mind :(. It was pure laziness that prevented me from showing the pane's label and editing it on the UI, the fact that my subpanels were already "fit to pane" meant that the label wouldn't show. In summary, I wasted a bit of time building a tool because I saw the "Highlight Object" method of the pane and got an idea. Kudos for pointing out that I should have just gone to the pane properties window!
Reply
5/22/2018 10:38:48 am
Nice little utility! A shortcut menu plugin with even more features can be found here:
Reply
11/14/2022 04:31:52 pm
Better pick whom one rich unit.
Reply
Leave a Reply. |
Tags
All
Archives
October 2019
LabVIEW Blogs |