Jump to content

Screen Coordinate of Control in Subpanel


klessm1

Recommended Posts

I am writing an X control that launches a popup that I want to place in reference to a control that is part of the XControl. It worked ok when the X Control was in a normal VI (even with multiple panes), but when that vi is in subpanel it always shows up in the same location. It gets the same "panel coordinates" everytime regardless of where the top level vi is placed, but changes when the subpanel is moved on the front panel of the main vi. It seems like I need to go one more level up, but so far have been unable to find a way to do that. It is almost like instead of "owning vi" I need the reference of the subpanels owning vi.

Here is the vi I am using. The vi with the magnifying glass recursively searches for controls within controls (e.g. clusters, tabs). Basically it finds the pane the control belongs to then finds the panel coordinates and then the screen coordinates.

post-2966-0-64781000-1349286450_thumb.pn

Does anyone have a trick to make this work for subpanels?

Much Thanks!

Link to comment

Since the XControl is only being used in my application and in one spot I was able to fudge a little and use the following code. Note the plus 10 which I think is due to splitters or panes not being at origin. I think NI also has a similar issue with their tip strips that has been documented. If you hover over control that is in a paned window that is in a subpanel you will see it. The location of the tip strip can vary and to get it in the correct place you have to scroll the pane. Maybe this is fixed in 2012, but haven't switched from 2011SP1 yet so I'm unsure. Anyway here is the code that seemed to work good enough for me to get by.

post-2966-0-02398900-1349890252_thumb.pn

  • Like 1
Link to comment

Since the XControl is only being used in my application and in one spot I was able to fudge a little and use the following code. Note the plus 10 which I think is due to splitters or panes not being at origin. I think NI also has a similar issue with their tip strips that has been documented. If you hover over control that is in a paned window that is in a subpanel you will see it. The location of the tip strip can vary and to get it in the correct place you have to scroll the pane. Maybe this is fixed in 2012, but haven't switched from 2011SP1 yet so I'm unsure. Anyway here is the code that seemed to work good enough for me to get by.

post-2966-0-02398900-1349890252_thumb.pn

Nice!

Personally I would get rid of that bundle/unbundle of Horizontal/Vertical coordinates, as it only adds confusion.

/J

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.