12-13-2013 08:29 AM
Hi,
I have a code that returns the front panel coordinates of a control. I use the same code and front panel design (splitter/pane layout) in two separate VIs, but I get two different result in each VI and I cannot find the difference between them. VIs are attached. I have LV2013 f2.
12-13-2013 08:38 AM
It depends on how you have scrolled, thus the position of your program in the frontpanel.
Can not open 2013 so it's just an edutated guess.
12-13-2013 08:43 AM
Same behavior in LV2012 - VIs are attached.
12-13-2013 08:48 AM - edited 12-13-2013 09:02 AM
Yes, now scroll a bit up and down.
The values will be different.
It's a bit of trial and error, to make it work correctly
I attached a dialog window that i made, this one is also using position to control the window size.
Dont forget to who the input array or replace it with a constant, otherwise the input will be 0 and will give an error
12-13-2013 09:38 AM
12-13-2013 09:59 AM
Thank you both for the answers, however, I think you didn't understand the problem or I wasn't clear enough.
I use code that returns the position of a control in coordinates of the front panel (regardless of the pane scrolling, etc.). I have two VIs that are the same (same front panel, same code - I think I didn't overlooked something), but they return two different results. I think that the result should be the same in both VIs?
Please look at the VIs.
12-13-2013 10:12 AM
12-13-2013 10:36 AM
This work if you do not use multi pane layout (splitters). This is because the origin property (pane property) returns coordinates relative to the coordinate system of the pane and not front panel.
See attached VI.
12-20-2013 02:48 AM
Dear Andrej,
you are indeed correct. If you happen to have multiple panels with splitters, the you have to account for the splitter positions as well, assuming they are to the left, or on top of your control. Here's some very simple code written for your example:
Of course to make it more flexible for any setup, you will need to add some tuning to that (you can programmatically get the right pane instead indexing with Owning property, check splitter Vertical? property to decide which coordinate to add to, check whether to include splitter based on position and other things I've been too lazy to properly code ), but this is the basic idea.
Kind regards:
03-25-2014 09:54 AM
Thanks Andrew,
I didn't have time to test this until now. I have an additional question, how do you know which splitters to add? Some of them can be below or right to the control and they shouldn't be added.