LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger a "Panel Resize" event programatically

Solved!
Go to solution

I have a pop-up dialog GUI VI with an event structure.

I am programatically positioning certain elements on the GUI based on the window size.  I do this positioning inside a "Panel Resize" event if the "Act" of the event was either "Maximize" or "Resized".

 

I would like to programatically trigger this event to run once when the VI first launches, to ensure that all my elements are properly positioned (in case something shifted during developement), however, the only way i have found to do that is to manually resize the window.

 

Of course a possible workaround is to put the positioning code in a sub-vi, but for various reasons I would rather not do that in this case, though I'll probably have to do it.. 

 

(I tried changing the panel size by -1 but this does not seem to genereate an event.)

 

So, is there a way to programatically create a "Panel Resize" event similar to a "Value (signaling)" property?

 

Thanks!

QFang
-------------
CLD LabVIEW 7.1 to 2016
0 Kudos
Message 1 of 7
(4,199 Views)

Create a "panel resize" user event, register it to the event structure and use the Generate User Event vi to trigger this event.

 

Search User Event in the LV Help file or take a look at the User Event Generation.vi example.

 

Ben64

0 Kudos
Message 2 of 7
(4,182 Views)

I did as you suggested, not sure what to use for the "data type" input, so I used the "Act" enum from the original Panel Resize event, but when registering for that event "type" there are no "OldBnds" and "NewBnds" available anymore so you have to remove them from your event frame "cluster" before you can run.

 

Based on this, I'm either doing this wrong, or there is no way to create or trigger a "true" resize event that provides all the "frame outputs" assoicated with a real resize event?

 

Not sure if it helps clarify anything, but the following composite screen shot shows the frame outputs for a panel resize event, and in the red box, the limited subset of frame outputs available if I also include the "user event".

 

Is there a secret place to grab a "panel size" event data type that I can use to create the user event, and if so, where do I find it?   (I'm guessing its in the same mythical place where you grab references to "group" items so you can easily move a group of objects with one property "position" command...)

event help.png

 

 

QFang
-------------
CLD LabVIEW 7.1 to 2016
0 Kudos
Message 3 of 7
(4,137 Views)

@QFang wrote:

I did as you suggested, not sure what to use for the "data type" input, so I used the "Act" enum from the original Panel Resize event, but when registering for that event "type" there are no "OldBnds" and "NewBnds" available anymore so you have to remove them from your event frame "cluster" before you can run.

 

Based on this, I'm either doing this wrong, or there is no way to create or trigger a "true" resize event that provides all the "frame outputs" assoicated with a real resize event?

 

Not sure if it helps clarify anything, but the following composite screen shot shows the frame outputs for a panel resize event, and in the red box, the limited subset of frame outputs available if I also include the "user event".

 

Is there a secret place to grab a "panel size" event data type that I can use to create the user event, and if so, where do I find it?   (I'm guessing its in the same mythical place where you grab references to "group" items so you can easily move a group of objects with one property "position" command...)

event help.png

 

 


I would not treat the user event in the same event case as the Panel Resize event. The user event can be of any type, if I understand correctly you just want to trigger an event. You can use the front panel window bounds property to get the dimensions of the front panel. You can use this cluster as data type.

Ben64

 

FP-Bounds.png

0 Kudos
Message 4 of 7
(4,130 Views)
Solution
Accepted by topic author QFang

As you can only resize and reposition FP objects by using property nodes, I don't see the advantage in keeping the functionality OUT of a SubVI. I have been doing this for years with a generic user interface which positions most oc the Objects relative to the FP bounds which is set relative to the workspace size on the primary desktop. You don't even need to pass in references as you can generate them using the VI call chain or other and getting an array of control references from the Panel. Provided that you define the position of each control by name, this actually works out quite nicely.

 

- My UI adds width to a large text box and auto spaces colunms based on a ratio within a 2D auto scaling Multicolumn listbox (add and remove rows based on number of pixels available to play with) As I never know what resolution someone is going to use for their monitor all I have to do is specify a minimum size and a maximum size that I have tested!

 

Think about it - you'll see it makes sense (also you can defer FPUpdates until all controls are respostioned to where they are expected thus speeding up the process).

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
Message 5 of 7
(4,127 Views)

You don't need trigger the event.

 

User producer-consumer design.

Don't handle the panel size inside the event structure.  Handle it in a case in the consumer loop.

 

When initial, enqueue the same case right after initial the queue.

 

 

 

George Zou
0 Kudos
Message 6 of 7
(4,116 Views)

yes, normally thats what I would do, however, for a quick pop-up dialog window, it is rather overkill to do a full blown producer consumer design.

 

I'll go with the previously suggested user event and sub-vi encapsulation (I felt inspired and started my own set of re-use VI's that take a generic control reference in, and positions it anywhere on its active panel/pane or in one of 9 pre-defined relative positions with optional offsets.. you can do a lot with vi server!)

 

 

QFang
-------------
CLD LabVIEW 7.1 to 2016
0 Kudos
Message 7 of 7
(4,101 Views)