LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Resizing Front panel to Object size

Hi,

I have a requirement for one of my programs. On my front panel I have different objects of different sizes. I want to resize my front panel window to the size of any particular object that I select. I should be able to maximize my window an then select another object to resize the Front panel again. This has to happen during th runtime of the program. ( in the sense, I don't want to freshly execute my program to resize it to another object) Please help me!!

 

Regards

Leena

0 Kudos
Message 1 of 12
(4,041 Views)

This seems like a very strange application...

 

You need to use property nodes to resize the front panel, and you need to respond to events. For the resize use Front Panel Window.Panel Bounds. For the events, you can respond to the Mouse Down event. At run-time I don't know what you mean by "that I select", since you can't really select controls/indicators at run-time. You can click on them, thereby setting the focus on them, and that will generate a mouse-down event for that control/indicator. If you have a lot of controls/indicators you may want to use dynamic event registration to register the Mouse Down event for all your controls/indicators. Search the examples (Help -> Find Examples) for "events" and open the "Dynamicall Register for Events" example. I can't really say whether this is the best way because, like I said, the application seems strange, and I don't know what you've got on your front panel. 

Message 2 of 12
(4,035 Views)

hi,

thanks for your quick reply!! I did mean clickling on the objects (not "select" sorry) I have already tried using the property nodes (Window bounds)..... but that doesn't give me exactly what I need. (but it is definitely something similar) The property node resizes the front panel with respect to the coordinates of the monitor (not the coordinates of the Front panel). Therefore I can resize the Front panel only to the objects that exist very close to the top left corner. I also tried the "mouse down event". The mouse down event "reads" the coordinates from the Front panel. But cannot find some property node that helps me input the Front panel coordinates. Yup, the application does sound strange, but i do need it!! Smiley Sad

0 Kudos
Message 3 of 12
(4,028 Views)

links wrote:

hi,

The property node resizes the front panel with respect to the coordinates of the monitor (not the coordinates of the Front panel). Therefore I can resize the Front panel only to the objects that exist very close to the top left corner.


Errr.. could you say that again in a different way? I don't quite understand that. 

 

There's a part of this that really doesn't make much sense to me. Let's say you have a front panel that looks like this: 

 

Now, if the VI is running, and you click on "OK 1", and I understood what you're saying, the new front panel should look like this: 

 

OK... Now how is the user supposed to be able to click on "OK 2"?  

Message Edited by smercurio_fc on 09-17-2008 10:02 AM
Download All
Message 4 of 12
(4,020 Views)
Message Edited by links on 09-17-2008 10:21 AM
0 Kudos
Message 5 of 12
(4,008 Views)

I will use the maximize button (title bar, top right corner) and then continue with clicking on my next object (in your example "OK 2" )

Message Edited by links on 09-17-2008 10:50 AM
0 Kudos
Message 6 of 12
(3,997 Views)
Well, you need to do like I said, and write to the PanelBounds property. You just need to keep in mind to udpate the value from the original value so you can correctly set the right and bottom properties. Also, you will need to shift the origin of the pane so that it centers on whatever control/indicator is clicked. This is not difficult to do. See attached example (LV 8.2) as a start.
Message 7 of 12
(3,981 Views)

wowww...... that is fantastic....... thanks a tonn...... that is exactly what i wanted!!!!

The property node "Origin"........ Thats the most important block in my program....... thanks again!!! Smiley Happy

 

regards

0 Kudos
Message 8 of 12
(3,968 Views)
Glad to hear that I got it right, whatever it was. Smiley Very Happy Just to satisfy my curiosity, can you explain a bit about the application?
0 Kudos
Message 9 of 12
(3,952 Views)

Yeah sure!!! I actually simulate a Control system using Labview. Most of the time, I run a number of vi's simultaneously, where each vi have Front panels that are the size of my entire monitor. Therefore in order to avoid switching between Front panels everytime, I manually resize all my vi front panels, to display only the controls and indicators I am presently using. This definitely consumed a lot f my time when i had to do it almost 10 - 15 times a day. Therefore i planned to modify my programs, where i could select the an area in the Front panel and the entire front panel would resize to the area I selected.

 

Have a look at the vi I attached!! Thats the modification I needed. I have put up some dummy controls n indicators on the front panel.

This is how it functions:

-  Press the "F3" key (on the keyboard) and simultaneously click and drag the mouse (front panel) over an area of interest.

-  Then release the mouse n "F3" key.

=> The front panel resizes to the area selected.

 

- Then hit the "F3" key once again

=> The front panel resizes to the standard (original) size.

 

- Maximize the window using the "maximize button" on the title bar, and then try hitting th "F3" key twice.

=> The front panel resizes again to the standard size.

 

Well thats my program. Hope my explanation is a little more clear this time.Smiley Happy

Thanks once again.

 

Regards

 

 

Message 10 of 12
(3,939 Views)