Jump to content
Sign in to follow this  
kingcobraninja

Resolve control from pane mouse down event and traversing xctls

Recommended Posts

For unspecified reasons, I want to be able to resolve which control has been clicked on from a pane mouse down event.  Our application is somewhat large and makes extensive use of sub-panels, so registering every control individually, statically or dynamically, would be a lot of work, maybe not very efficient, and would require ongoing resource tracking once registered, so the pane mouse down event in a top level VI would be preferred.

 

I've written a VI that takes a pane reference and pane coordinates (hypothetically from a mouse down event) and resolves the first, if it exists, control that resides on that pane and contains those coordinates within its bounds.  The VI also considers the control class, and if it is a subpanel, gets the inserted VI, it's panel, and any pane that contains the coordinates and recurses.  In this manner, the VI traverses arbitrarily deep nested subpanels until it gets to the control that was clicked on.

 

This is where it gets (more) complicated.  I also want to traverse xControls.  When a control within an xcontrol is clicked on, I want the reference to the (sub?) control, not the xcontrol.  It is simple enough to detect whether a control is in fact an xcontrol, but apparently more challenging to get any more information than that.  So my questions are these:

 

From an control reference where IsXclt=T, is there a way to get a reference to the xcontrols panes or some owner (panel, facade vi, clone name)?  I realize I could do this by setting a custom property of the xcontrol, but then it would not be generic to xcontrols and would again require sprawling coding effort.

 

or

 

Is there an entirely different and simpler way to achieve what I am proposing in the first paragraph?

 

This is in LV2012sp1 btw.

 

Thanks for reading; any help or suggestions would be appreciated!

Share this post


Link to post
Share on other sites

You would need to cast to an XControl reference, get the "facade" VI reference and parse from there.  I have to admit I don't know how to do this, but I have never tried either.

Share this post


Link to post
Share on other sites

shoneill,

 

This was my first thought, but I've not been able to find a generic xControl class, only classes of xControls currently in memory, and xControl project classes, which I haven't yet led anywhere productive.  If you can show where a generic xControl class exists in the class hierarchy, this may be the key to the problem.

Share this post


Link to post
Share on other sites

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.

Sign in to follow this  

×
×
  • Create New...

Important Information

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