LabVIEW Craft
  • Blog
  • About
  • Contact
  • Tools
  • Resources

Pane Label Pain

3/16/2017

3 Comments

 
Jon McBee
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.
Picture
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.
Picture
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.
Picture
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."
Picture
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.
Picture
Zooming in on the pane discovery bit before the while loop.
Picture
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.
Picture
And here is a look at the right click on the listbox.
Picture
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
3 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
Ian Nicholson link
5/22/2018 10:38:48 am

Nice little utility! A shortcut menu plugin with even more features can be found here:

https://forums.ni.com/t5/LabVIEW-Shortcut-Menu-Plug-Ins/Setup-Splitters-and-Panes-llb/ta-p/3536994

Reply



Leave a Reply.

    RSS Feed

    Tags

    All
    Abstract Messaging
    Actor Framework
    Agile
    AI
    Asynchronous Programming
    Best Practices
    C#
    Complexity
    Continuations
    Control Values By Index
    Craftsmanship
    Dependency Inversion
    Dependency Viewer
    Futures/Promises
    Genetic Algorithm
    Liskov Substitution
    Malleable VIs
    Mediator Pattern
    .NET
    Object Oriented
    Object-Oriented
    Packed Project Library
    Parallelism
    Polymorphism
    Pub/Sub
    RawCap
    Root Loop
    Scrum
    Task Parallel Library
    TCP/IP
    TDD
    Test Engineering
    UML
    Unit Test
    VI Scripting
    VI Server
    WireShark

    Archives

    April 2019
    July 2018
    October 2017
    March 2017
    February 2017
    January 2017
    December 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    February 2016
    January 2016
    December 2015
    November 2015
    October 2015
    August 2015
    February 2015
    January 2015

    LabVIEW Blogs

    Eyes on VIs
    LabVIEW Hacker
    VI Shots
    LabVIEW Artisan
    Software Engineering for LabVIEW
    ​Wiresmith Techology
Picture
Powered by the Panda Ant

  • Blog
  • About
  • Contact
  • Tools
  • Resources