03-30-2010 10:47 AM - edited 03-30-2010 10:49 AM
I would like my subVIs front panel to be centered (or generally centered) over my main VI. It is just showing the user that the program is cranking while it looks for a connection. However, the subVIs front panel isn't being placed in the proper place on the screen. Am I doing something wrong here? Also, please ignore the awful use of locals (and unclosed references), they will be gone in the near future :). It was just the quickest way to stop right now as I test this.
The run time location is set to unchanged in the VI properties.
03-30-2010 10:54 AM - edited 03-30-2010 10:55 AM
So why do you have the Run-time position set to Unchanged and not to "Centered"?
Anyway, to move the window programmatically use the VI property "Front Panel Window > Window Bounds" or "Front Panel Window > Panel Bounds"
Hope this helps.
03-30-2010 10:57 AM - edited 03-30-2010 10:59 AM
dan_u wrote:So why do you have the Run-time position set to Unchanged and not to "Centered"?
Anyway, to move the window programmatically use the VI property "Front Panel Window > Window Bounds" or "Front Panel Window > Panel Bounds"
Hope this helps.
Centered puts it centered on the monitor, not over the main VI. That's why I pass in the main VIs coordinates then calculate the center. However, are you sure I have to size it at a specific left right top bottom to place it where I want? I can't just position it?
03-30-2010 11:00 AM
It's the same property to size and to position the VI. If you just want to move it you will have to add/subtract the same numbers to/from left and right (and the same numbers to/from top and bottom).
Or in other words: Make sure the differences bottom-top and right-left remain unchanged.
03-30-2010 11:01 AM
for(imstuck) wrote:
dan_u wrote:So why do you have the Run-time position set to Unchanged and not to "Centered"?
Anyway, to move the window programmatically use the VI property "Front Panel Window > Window Bounds" or "Front Panel Window > Panel Bounds"
Hope this helps.
Centered puts it centered on the monitor, not over the main VI. That's why I pass in the main VIs coordinates then calculate the center. However, are you sure I have to size it at a specific left right top bottom to place it where I want? I can't just position it?
Message Edited by for(imstuck) on 03-30-2010 10:59 AM
I say "center" but my method for calculating, I know, wont position it perfectly over the center. But it will be close enough. I just can't figure why the fp wont move at all...
03-30-2010 11:02 AM
03-30-2010 11:43 AM
03-30-2010 11:43 AM
You need to do a bunch of calculations. Your method will put the subvi left and top at the middle of the main vi, but the subvi will not be centered. You need to calcualte the difference in width betweent the two vi's, divide by 2, set the subvi left position to the main left plus the divide by 2 result, set the right to keep the same width as before.... and so on.... See the snipit: