10-17-2023 11:13 AM
Calling all SubPanel experts,
I currently have a system in place similar to the screenshots I've attached (can't attach the actual screenshot for sensitive data reasons) where I have a Sub-VI inserted into a SubPanel.
The problem I am facing is that once the sub-vi is loaded into the SubPanel, the user is able to scroll infinitely beyond where the controls are. However, I know it is possible to (none-programatically) stop this from happening because, in the example I attached, this is the case!
I cannot for the life of me figure out what the example VI I attached does differently to mine. I have tried inserting the VI into the SubPanel before running it and vice versa, I have tried putting my controls in a cluster control and putting that in a sub-vi and then the SubPanel. I am lost, any help would be appreciated. Thanks in advance!
tl;dr I have inserted a Sub-VI into a SubPanel and it allows the user to scroll past all the controls infinitely into nothingness. How do I fix that?
Solved! Go to Solution.
10-17-2023 11:32 AM
Why not remove the scroll bars from your VI? They do not have to be visible. I never show scroll bars for the VI, only certain indicators.
10-17-2023 02:07 PM
The scroll bars are automatically generated based upon the vi front panel size with respect to the Sub-Panel size. If the vi is modified to a smaller size or the sub-panel stretched larger, it is possible to fit within the Sub-Panel window without scrollbars.
10-17-2023 02:16 PM
What you want to do is to "lock" the Front Panel. There are two ways to do this (I learned the second way about a month ago by an answer on this Forum).
Bob Schor
10-18-2023 04:07 AM
The scroll bars are necessary as the content spans further than the edge of the screen so you need to be able to scroll to view it all. However it lets you scroll past the end of the content, which is the problem. Hope this clarifies some things.
10-18-2023 04:29 AM
Hello, I attempted both of these solutions, to no avail. I have attached screenshots of an obfuscated version of my FP and BD, the VI Properties, as well as Run-Time demonstrations in the hopes that this sheds some light on what I'm doing wrong.
I have also attached the example code I was using to debug (which works the way I want mine to) as a reference. It is the "Scrollable Cluster.zip" attachment.
Any help on this matter is greatly appreciated, it has been driving me insane.
Thanks in advance
10-18-2023 04:33 AM
Hello, the scroll bars on the SubPanel do not appear to be automatically generated for me. They just allow me to scroll infinitely. Also, as I have mentioned in a previous post, the scroll bars are necessary for this implementation as the controls span further than the edge of the application window.
I am using LabVIEW 2021 if that is of any use.
Thanks in advance
10-18-2023 05:27 AM
The only way I know of to get scrollbars (of arrays, panels, etc.) to do what you want is to use your own scrollbar controls, and program their behavior.
So you make a vertical and horizontal scrollbar, place them at the right and bottom of your FP (that is sized to your subpanel's size). That catch the scrollbar's value change events, and move the FP origin accordingly, correcting the scrollbar's positions.
Or make yet another subpanel, so you have a VI that manages the scrollbars and the panel inside it's subpanel and control that panel's origin...
Using the size of the FP you want to move and it's view size, limit the scrollbar's values and set it's page size...
Doable, but quite daunting. You might want to pick your battles (and skip this one).
10-18-2023 05:40 AM
Thank you for the suggestion, I may try that if all else fails. However, I know that is is possible to do without any extra programming. The example project I attached as a zip file manages this without any extra (as does this other example I found that I have attached).
I'm confused why theirs work and mine doesn't. I even found a Sub-VI within my own project that, when inserted into the SubPanel, had the properties I wanted (not scrolling infinitely and adjusting the scroll bar according to the borders of the outermost controls in the sub-vi). So, I figured I'd copy that VI and see if I can replicate its properties with the controls I actually want. However, somehow even when copying a Sub-VI I knew worked, when I add the controls I want, it no longer works the way I intended?
I feel like I am missing a small setting somewhere, perhaps even an issue with the SubPanel itself rather than the Sub-VI I am inserting into it?
Sorry for all the hassle, and thank you for your help and time thus far.
10-18-2023 07:08 AM
Hello all!
I have found the solution!
The Sub-VI that is inserted into the SubPanel must be running constantly (even if the Run VI invoke node method has been called, which is a requirement anyway). What I mean by this is that the Sub-VI must be being called by something, either by the Sub-VI itself (i.e. a while loop within the Sub-VI forcing it to run constantly), or by calling the VI by reference within the main window BD. This may have been obvious to some folks, but I figured scrolling shouldn't be affected by whether or not the Sub-VI is actively executing considering I had already ran the "Run VI" invoke method (maybe needs documenting/naming better so people understand its purpose more?)
Anyway, I hope this helps anyone else stuck on this issue!