LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically centering object in a subpanel

Hi!

 

In an attempt to limit the number of pop-up windows for an application I'm developping, I'm trying to use a single Sub-panel that will either show the "main screen" or display sub-vi's front panels (like settings, parameters, status etc.)

I enclose a very simple to illustrate my situation with a small main interface running a dummy graph and a dummy status window under the main application. I'm using notifiers to close the two sub-vis (In my application I am using queues and notifications in the same principle than here)

 

 There are 2 things that are bothering me/I'm struggling with.

  1. I want my window to be resizable: For the graph its easy, the bigger on the screen, the better. But if I then click on "Status", my cluster status is on the top left corner (as I placed it there), how do I manage to place it automatically in the center (as I don't want it to resize with the window)
  2. I've realized that in this example, when I resize the window to a bigger size while in the "graph" tab, then the whole interface is lagging a lot, do you know why? I should point out that in my real application, the graph isn't displayed in a sub-panel but in the main window and is getting data from a queue.

 

I hope I was clear, thank you in advance for you help.

Vinny.

0 Kudos
Message 1 of 7
(1,996 Views)

I haven't checked your code yet, but it might be worth searching for information about "Splitter Panes" - these allow you to partition your front panel into chunks, and then you can more easily have LabVIEW autoscale bits (if you already demonstrated this in your code, sorry!)

There are also some dynamic sizing VIs in the "Hidden Gems" package (search VIPM), but I haven't tried using them and don't know if they're appropriate here or not...


GCentral
0 Kudos
Message 2 of 7
(1,962 Views)

So I've already tried using splitters for my buttons at the bottom in a failed attempt to alway keep them bottom-centered:

This is the minimum-sized window and it looks fine

VinnyLaTaupe_0-1623934315138.png

As soon as the window gets wider, the buttons are not centered anymore

VinnyLaTaupe_1-1623934362861.png

 

I understand that you meant using splitters on my Status.vi front panel, right? But already in my main i'm struggling to keep something centered...

Parameters for my bottom vertical splitters:

Left: Splitter sticks right

Right: Splitter sizes proportionally

 

 

I've never used specifically packages from VIPM yet (apart from drivers), might be a good opportunity to try.

 

 

0 Kudos
Message 3 of 7
(1,954 Views)

I could not run your code because a TypeDef (Coms Status) was missing.  But a possible "fix" for your problem is to set the Window Run-Time Position property of the VI you want to run in the Sub-Panel as "Centered" (instead of "unchanged").  You should also set the VI you want to display so that it fills its SubPanel (which you've done).

 

Bob Schor

 

P.S. -- speaking of VIPM, the OpenG Toolkit includes the Application Control VIs that has "Fit Window to Largest Decoration", which I use for all my sub-Panel VIs.  I wrap a Box or a Frame around the part I want to see in the Window, put this function as the first one in my VI, run it to size things, then save the VI, properly sized.  If things "move a bit" during subsequent editing, I can always "manually resize" it by simply hand-running it again.

Message 4 of 7
(1,943 Views)

Hi Bob,

 


@Bob_Schor  a écrit :

I could not run your code because a TypeDef (Coms Status) was missing.


My bad, I thought I've disconnected it. Anyway here it is, also saved in LV19 this time.

 


@Bob_Schor  a écrit :

a possible "fix" for your problem is to set the Window Run-Time Position property of the VI you want to run in the Sub-Panel as "Centered" (instead of "unchanged"). 

...

P.S. -- speaking of VIPM, the OpenG Toolkit includes the Application Control VIs that has "Fit Window to Largest Decoration", which I use for all my sub-Panel VIs.  I wrap a Box or a Frame around the part I want to see in the Window, put this function as the first one in my VI, run it to size things, then save the VI, properly sized.  If things "move a bit" during subsequent editing, I can always "manually resize" it by simply hand-running it again.


I'll give these a try thanks!

 

Would you mind running my code and tell me what happens when you display the graph with the window maxed on your screen?

I'm curious (and concerned) about this lag I'm having.

THanks.

 

Vinny

0 Kudos
Message 5 of 7
(1,877 Views)

If I just run your main routine and press no buttons, I get this:

Vinny sub-panel.png

If I push "Status", I get Error 1144, cannot insert sub-panel because already open (I think it means Status is already open).  I didn't investigate more.  I don't usually use Notifiers, so I didn't try to understand what you were doing with them -- I suspect there's a much easier way to do what you are trying to do.

 

Bob Schor

Message 6 of 7
(1,837 Views)

Hmmm have you closed the other VIs? (The main manages all the executions and the two other VIs must be closed to be placed in the subpanel)

I haven't done any error management as it was really just an illustration for UI stuff.

 


@Bob_Schor  a écrit :

I don't usually use Notifiers, so I didn't try to understand what you were doing with them -- I suspect there's a much easier way to do what you are trying to do.

 

Bob Schor


I'm just using the notifiers to wait for the subvis (status and graph) to exit their loop before closing the main (and closing the references) as I'm running them in call and forget.

I'm pretty sure there is an easier way! Again, just a quick example.

Have you encountered any lag in the update of the graph (checking the X axis) when maxed out on your screen? 

 

Vinny.

0 Kudos
Message 7 of 7
(1,785 Views)