XControl Facade VI/Panel Reference

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!

It is in fact for run-time operation.  We most often use xControls as modular multidemensional input where reconciliation is needed to prevent forbidden input.  If the same style input is needed in a new part of our application, instead of replicating the code needed to forbid forbidden input, we drop in the xControl and let it handle it.
Our application also detects every mouse down event and opens or closes an on-screen keyboard as needed.  If an enabled control was clicked on, open the osk, else, close.  However, we sometimes open a special number pad for numeric controls.  This is basis for wanting to interpret the xControl as component controls, as you can imagine complex input might have both string and numeric components.
I knew I was stretching the limits of what xControls are intended for, but I am somewhat disappointed that NI hasn't made run time access to xControl components possible, considering how useful it would be in this one exceedingly esoteric instance, and possibly several others, encapsulation impositions notwithstanding.
Thanks anyway for the review; we'll figure something out.

Similar Messages

  • Error 1032 accessing Front panel reference on 6.1 EXE from 7.1.1f2

    I am installing a Data Acquisition system developed in 7.1.1f2 (.net 2.0 patched).  The system has 4 device drivers reading data from different components (SCXI DAQ, OPC/DSTP, DLL Library, and a Labview 6.1 executable)  When I got on site, I modified the 6.1 EXE's INI file to allow TCP access to * and export * on a specified port.  The driver accessing the 6.1 EXE was reading the digital values correctly but I also needed to read XY Graphs along with the plot configurations and coloration.  I then wrote a simple debug VI that Connects to the 6.1 EXE's Win 2000 Machine the Application reference succeeded, I open a reference to the exported main vi and seem to access all the properties and methods of the VI except the Front Panel calls.  Some of the calls return invalid data (read this is the default result if an error is encountered)and when I try to get the Front panel reference I get error 1032.  I need to get this working in order to get the control references of the waveform graphs, in order to get the plot information. 
    Things I tried:
    1 - I have tried accessing the FP reference from a different machine running LV 7.1 but still get the same error.
    2 - The 6.1 EXE belongs to our client and we cannot modify it, but I have reinstalled it from the backups with no change.
    I don't have any idea how to proceed..
    What else can I verify on the remote VI server,  Is there another way to read the plot data from a graph?  (VI ref --> Get control value mostly works untill the fill color changes on the plots)
    Any Help / guidance would be appreciated.
    Darcy

    Hello Darcy-
    It sounds like you are running into a common problem when trying to access a front panel on a remote executabel. The following KB gve a  bit more clarification on teh nature of the problem adn a possible workaround. The workaround will require modification of the EXE you wish to control, and it sounds like that may not be an option for you.
    http://digital.ni.com/public.nsf/websearch/B36BCCBFEBECF4F486256C69005D49C3?OpenDocument
    If the Vi you wish to communicate with is not written to share its data in any way, it is going to be difficult/impossible to read the the waveform vales from that VI.
    Xaq
    Message Edited by Xaq on 11-21-2006 03:29 PM

  • Panel References - second (and more) Level References

    Does anybody have some knowledge about achiving control ref's of
    frontpanel controls which are located on register elements, in
    clusters etc.
    I like to know more about this because I wish to automate the
    generation of references to my Frontpanel CTRLs instead of creating
    them manually.
    On the route of the vi/panel reference I only achieve the first level
    references, so I can't go that way.
    Thanks for help.

    Hello,
    I have find this Website.
    http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RNAME=ViewQuestion&HOID=506500000008000000D63E0000&ECategory=LabVIEW.LabVIEW+General
    Hope this helps,
    best regards.
    Sebatian N.
    NI Germany

  • Question on closing Front Panel references

    I'm manipulating controls on the Front Panel of my VI.  In doing this, I open a slew of references (to the VI, to the Front Panel, to its Panes, and to the objects on the Front Panel).  Normally, before exiting the VI, I carefully close them (in LIFO order, of course), but a question has arisen:
    I want to "export" a series of references to Boolean controls for use in succeeding VIs.  No problem, while enumerating the controls (see above), I simply identify the Boolean references and build them into an array that I pass out.  First question -- does anything "go wrong" if I also do a "Close Ref" in the main loop (after adding the reference to the array, of course)?  [At present, I'm only doing a Close Ref on the non-Booleans].  Logic says this should be OK, as the Close Ref is mainly doing "garbage collection", and I've done a "copy" operation in building my array, but to a persistent structure.
    Second question -- in my "cleanup" routine, I noticed I was "double-disposing" of the references, that is, I did a Close Ref on my array of Boolean References, but also was enumerating the entire Front Panel (as I did when I opened it) and disposing of the references that it found.  Again, this should be no problem, but (in principle) I'm doing a Close Ref on two references to the Boolean control.  It occurs to me that this is not really logical either -- I should be able to simply "abandon" the array of references -- although it takes up memory that can be "reclaimed" for other uses, the fact that it is an array of RefNums is a "so what" -- the contents of the array could have been a numeric or other "solid" data type.
    Does this make sense?  To summarize, what I'm trying to do is to "extract" some RefNums to Front Panel objects for later use.  In the "extraction" process, I must open (and create references to) multiple objects, including RefNums to my "objects of interest".  What I think I can (and should) do, once I've copied the RefNums I need, is to dispose (Close Ref) all of the RefNums that I opened during the extraction routine, and do something equivalent when I do the subsequent "cleanup" (which undoes any modifications I made as part of the extraction).
    Comments welcome.
    Bob Schor

    I usually store the ref. at the beginning of my program, in Functional Globals, and i close them when the program does not need them any more. 
    I think this is the right approach. And it is simple

  • Error 1004 occurred at Open VI Reference in Directory of Top Level VI.vi- Check Path.vi- Read PNG File.vi- ValveUI.xctl:LoadBackgroundImage.vi- ValveUI.xctl:Facade 1.vi:29- ValveUI.xctl:Facade 1.vi.ProxyCaller

    I am trying to dynamically load the background image of an XControl facade using a 'LoadBackgroundImage.vi' that I have written. This SubVI has worked with a normal VIs panel before. It utilizes the 'Read PNG File.vi' from Labview to read in a transparent PNG file to overwrite the Facade background. When the XControl is loaded during design-time it generates an Error 1004 indicating that the 'Read PNG File.vi' is not in memory. I have tried to place a static reference to this vi to force it to load but I still get this error. What is the solution?
    Attachments:
    Error Dialog.PNG ‏9 KB
    LoadBackgroundImage_VI.PNG ‏33 KB

    Darin, thanks for your reply.
    The XControl Facade is rendered on the Main FP when the Main.vi is opened in design mode. Previously I have placed a PNG image onto the Facade pane (i.e. drag-n-drop the image onto the Facade FP during design) and it is displayed on the Main.vi FP in design mode when Main is loaded. However, when I include a call to Read PNG File.vi in the Facade I get the 1004 error. You may not see this error without using a Simple Error Dialog. This failure to find Read PNG File.vi in memory is the main issue.
    I have tried to use SubPanels before - they are useless for my purposes for many reasons (they don't show the underlying SubVI pane in design mode, they require the use of SubVI references to load - preventing the use of direct wiring to the SubVI connector, etc.).
    Do you know how to dynamically load and call 'Read PNG File.vi' so that Labview is forced to load the VI and then Read PNG File can load the PNG image? I can get 'Read PNG File.vi' to dynamically load and show property values but to call it with the 'Call By Reference Node Function' I need a strict type def to be generated, etc. So what are the steps needed to create a dynamic call to 'Read PNG File.vi'? I haven't seen any good working examples that show how to create the strict typedefs that are required etc. There is no right-click > Make Type Def > ...  for Read PNG File.vi or other ways to do this that I have noticed. Showing a finished example doesn't show you how to do it (menu selections, etc.). Or, do I have to hand construct these typedefs by reverse engineering the VI?

  • Why XControl's reference is invalid?

    There are 60 XControls on front panel.I get their reference by a subvi and then output their label text by property node.It's ok when vi run in labview 8.5 IDE.Then I build the program to exe file.The refrence is invalid when I run the exe file .So what's wrong about the exe file?
    Thanks!

    I hava sloved my problem .The problem occured when a common reference  translated into special reference .Jsut like the image:
     When running the exe file,CargoBlock reference is invalid.But I change the method that gets CargoBlock reference ,as follows:
    The problem disappears...

  • How can I get a reference to all controls on a front panel of one type )for example of the type Text Ring?

    I'd like to set the strings[] property of all the Text Ring controls on a front panel at once without creating a property node for every text ring. How can i do that?

    > How can I get a reference to all controls on a front panel of one type
    > )for example of the type Text Ring?
    >
    > I'd like to set the strings[] property of all the Text Ring controls
    > on a front panel at once without creating a property node for every
    > text ring. How can i do that?
    This is likely more complicated than making property nodes for each
    ring, but you can do it. Make a subVI that takes in a panel reference,
    reads the array of control references, loops through them looking for
    rings, and modifying the Strings[] property on each ring.
    The part of this that will probably be the least obvious, when you
    have an array of control references there are two ways to find out
    if an element is a ring. You can read the classID and compare it
    to the cla
    ssID of a true ring control. An alternative is to cast
    the control reference to a ring control using a Cast to more specific
    node and wire the error out to a case structure. The error case is
    where the objects that aren't rings will go. The success case case
    where you will have a valid ring refnum that you can use to modify
    the strings.
    Greg McKaskle

  • How do I create an xControl with multiple inputs and outputs?

    Hello,
    i am trying to write a new Xcontrol Element. In the data model I can create data types using the cluster to create compound types, eg an int and an int array. But how do I create an xcontrol which has multiple data inputs and outputs?
    Kind Regards

    Limping_Twerp wrote:
    Alright: I see: An xcontrol is either an input OR an output. How do I achieve an output? Secondly: So you are saying the only Elements that can have multiple inputs and outputs are VIs?
    Can you take a few steps back and explain what you are actually trying to do. SubVIs and Xcontrols have nothing in common and it is not clear why you even try to compare them side by side (e.g. in terms of the number of connectors).
    Your questions about input or output tell us that you seems to have some misconceptions about xcontrols. Xcontrols are like regular controls, except they have some built-in intelligence that you can program. Most front panel object can be either controls or indicators and the same is true for Xcontrol. You create an Xcontrol, and after placing it on the front panel you can decide if it should be a control (where the code reads the value) or an indicator (were the code writes values to it). When you define the xcontrol facade, you also need to program how the visuals change if it is changed from control to indicator or vice versa.
    As a first step, you should opend the example finder and look at some xcontrol examples.
    Again, what are you actually trying to do? 
    LabVIEW Champion . Do more with less code and in less time .

  • Change XControl direction: changing direction of child VIs

    Hi,
    I'm writing an XControl containing several booleans, with a numert output based on which button is True, but I cannot change the direction of the Buttons when the direction of the XControl is changed in the VI using it:
    In the owning VI, in Edit mode, I change the direction of the XControl via the drop-down menu.
    In the XControl, the Direction Change event is triggerd, with {Indicator=True/False; RunMode=False}
    I then set the Indicator property of the VIs in the XControl, but recieve an error (see below)
    I also noticed this bug: wiring the error to an Error indicator on the XControl Facade yields:
    Code: 1073
    Source: Property Node (arg 1) in ControlSystem.lvlib:Filtermodes.xctl:FilterModes Facade.vi:31->ControlSystem.lvlib:Filtermodes.xctl:FilterModes Facade.vi.ProxyCaller
    <APPEND>
    Property Name: <b>Indicator</b>
    Whereas a probe shows:
    Error 1073 occurred at Property Node (arg 1) in ControlSystem.lvlib:Filtermodes.xctl:FilterModes Facade.vi:31->ControlSystem.lvlib:Filtermodes.xctl:FilterModes Facade.vi.ProxyCaller
    Possible reason(s):
    LabVIEW: This property is writable only when the VI is in edit mode, or this method is available only when the VI is in edit mode.
    Property Name: Indicator
    Also, one cannot call 'Explain error/warning' on Error indicators in XControls form the using VIs
    How can I change the
    direction of the buttons in my XControl to match the direction of the XControl?
    TIA,
    Jonathan

    An
    XControl dropped on a front panel (whether the FP is in an XControl or
    not) is ALWAYS in run-mode.  It is essentially a parallel process to the
    VI in which it is contained.
    So even if the VI is not running, all the XControls
    on it's FP are running?
    I think this is the problem
    when you are trying to set the direction in your code.
     This 'code' is the direction change handler in the XControl Facade, if the above is true, then I'm out of luck I guess
    You want to set the direction of other
    XControls contained within your XControl? Is this right?
    Not exactly, I want to set the direction of normal control (Customized, but not an XControl), contained in the FP of my XControl, although it seems like that won't change much
    Based on the comments LabView adds to XControls, it seems that the Facade is not running in between processing events, so maybe one could change the direction of the controls after the event handling is done (Some kind of callback)?
    My current work-around is to disable my controls in indicator mode, since disabled Modern OKButton controls look identical to their indicator
    Thanks,
    Jonathan

  • Xcontrol: performance question (again)

    Hello,
    I've got a little performance question regarding xcontrols. I observed rather high cpu-load when using xcontrols. To investigate it further, I built a minimal xcontrol (boolean type) which only writes the received boolean-value to a display-element in it's facade (see attached example). When I use this xcontrol in a test-vi and write to it with a rate of 1000 booleans / second, I get a cpu-load of about 10%. When I write directly to a boolean display element instead of the xcontrol,I have a load of 0 to 1 %. The funny thing is, when I emulate the xcontrol functionality with a subvi, a subpanel and a queue (see example), I only have 0 to 1% cpu-load, too.
    Is there a way to reduce the cpu-load when using xcontrols? 
    If there isn't and if this is not a problem with my installation but a known issue, I think this would be a potential point for NI to fix in a future update of LV.
    Regards,
    soranito
    Message Edited by soranito on 04-04-2010 08:16 PM
    Message Edited by soranito on 04-04-2010 08:18 PM
    Attachments:
    XControl_performance_test.zip ‏60 KB

    soranito wrote:
    Hello,
    I've got a little performance question regarding xcontrols. I observed rather high cpu-load when using xcontrols. To investigate it further, I built a minimal xcontrol (boolean type) which only writes the received boolean-value to a display-element in it's facade (see attached example). When I use this xcontrol in a test-vi and write to it with a rate of 1000 booleans / second, I get a cpu-load of about 10%. When I write directly to a boolean display element instead of the xcontrol,I have a load of 0 to 1 %. The funny thing is, when I emulate the xcontrol functionality with a subvi, a subpanel and a queue (see example), I only have 0 to 1% cpu-load, too.
    Okay, I think I understand question  now.  You want to know why an equivalent xcontrol boolean consumes 10x more CPU resource than the LV base package boolean?
    Okay, try opening the project I replied yesterday.  I don't have access to LV at my desk so let's try this. Open up your xcontrol facade.vi.  Notice how I separated up your data event into two events?  Go the data change vi event, when looping back the action, set the isDataChanged (part of the data change cluster) to FALSE.  While the data input (the one displayed on your facade.vi front panel), set that isDataChanged to TRUE.  This is will limit the number of times facade will be looping.  It will not drop your CPU down from 10% to 0% but it should drop a little, just enough to give you a short term solution.  If that doesn't work, just play around with the loopback statement.  I can't remember the exact method.
    Yeah, I agree xcontrol shouldn't be overconsuming system resource.  I think xcontrol is still in its primitive form and I'm not sure if NI is planning on investing more times to bug fix or even enhance it.  Imo, I don't think xcontrol is quite ready for primetime yet.   Just too many issues that need improvement.
    Message Edited by lavalava on 04-06-2010 03:34 PM

  • Eliminate margin around Xcontrol

    Hello, all!
     I'm trying to create an Xcontrol using a combo box on the Facade.  I would like to adjust the Facade window size so that when I drop the Xcontrol onto a panel, there is no space between the edges of the combo box and the Facade window.  I've tried to adjust the control and window sizes manually, but it's been a frustrating process, to say the least.  No matter what I do, the Xcontrol window is always larger than the combo box.  Any suggestions?
    Thanks,
    Slowpoke 
    Slowpoke
    CLAD (believe it or not!), using LabVIEW 8.5
    They don't call me "Slowpoke" for nothin'!

    I didn't have a specific problem doing this. What version of LabVIEW are you using? Is the attached (LV 8.2) what you're trying to do?
    Attachments:
    XControl.zip ‏37 KB

  • Tabbing between xcontrols

    Dear all,
    I need to tab between multiple XControl controls on my UI front panel.
    The tab order has been set for each XControl on the front panel
    The XControls are of the same type and only have a single numeric control in the facade.
    Currently using the tab key just highlights the numeric control in the XControl facade and does not move the focus to the next XControl as specified by the tab order.
    Is there any way to tab between XControls?
    Thanks,
    P

    It might be behaving like a tab within a cluster.  If you have a control selected in a cluster then tabbing will just cycle through controls in that cluster.  You need to CTRL + Up Arrow or Down Arrow to go into or out of structures.  I assume the XControl is behaving like that.  You could try to do some fancy work detecting the tab button press, and then intercept it and press CTRL + Up, then CTRL + Tab if the keyfocus is in your XControl if this is the case.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • Closing references out of order?

    I am filling a tree control from a Sub-VI, and I would like to use the DeferPanelUpdates property while I do that.  I would like to put the DeferPanelUpdates property node in the sub-vi so the main vi's block diagram isn't cluttered with it.  So since I already pass a reference to the tree control, I get it's OwningVI, and the FrontPanel from that.
    The help for OwningVI says to close the reference to it when you're done using it.  But since I get the panel reference from it, do I have wait until I close the panel reference before closing the VI reference? I'm just not sure when I am "done" with the VI reference, if you know what i mean...
    Also, do I need to wire all the error terminals on the property nodes? If the tree refnum is invalid, would OwningVI and thus FrontPanel also return invalid refnums? If that were the case, I could just check the last property node's error terminal.
    Any ideas?
    BTW, I found out about DeferPanelUpdates on one of Darren's Nuggets.  From there, there is a link to a thread about when to close references.  It didn't say anything about what to do about references obtained from other references though.
    Thanks,
    John
    Attachments:
    tree-vi-panel-refs.gif ‏11 KB

    Good question, John.  In your case, it is safe to close the VI reference at whatever time you wish.  In my experience *with VI Server* (these suggestions may not apply with other reference types, like ActiveX), if you get references as properties from other references, you can close them in whatever order you wish.  The only time it would be bad to close the VI reference first would be if you obtained it from an Open VI Reference function, and that was the only reference open to the VI.  If you close that reference to the VI, then there are no other references to it, and the VI is not in memory (assuming you don't have it open)...at that point, any subsequent property reads/writes would return an error.
    As far as your question about error chaining, you should definitely wire the errors...there are many reasons you could get errors from property nodes...invalid references, trying to set some properties while the VI is running, certain properties that don't work with objects configured a certain way...don't ever skimp on your error handling, *especially* with VI Server!
    When I work with VI Server and a bunch of different class properties, I find it helps to keep my error chain straight, and route reference wires accordingly.  It helps me keep with the program flow better...here's how I would have wired the diagram you gave above:
    Hope this helps, and I'm glad you discovered my nugget about Defer Panel Updates.  When doing code reviews of UI applications, that is probably the recommendation I've given the most times over the years...
    -D
    Message Edited by Darren on 01-23-2007 10:31 PM
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman
    Attachments:
    straight_error.png ‏8 KB

  • How can I Change data in a type def control containing a Xcontrol with a local variable

    Hello
    I made a Xcontrol and I inserted this control in a type def.
    When I want to change the control's data with a local variable in a VI, the VI change nothing. The change of data isn't perform
    How can I correct this issue?
    Thanks for your help
    Solved!
    Go to Solution.

    Hello,
    What's your LabVIEW version ? Do you have a simple example program which demonstrates this behavior ?
    I found another discussions related to your issues with Xcontrols:
    updating type defs in Xcontrol Facade
    No Data Change event generated for a XControl in a Type Def
    XControl facede.vi 
    Hope this helps.
    Regards, 
    Steve M.
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    >> Vidéo-t'chats de l'été : présentations techniques et ingénieurs pour répondre à vos questions

  • How can i get the reference to Controls from VI-reference

    Hello,
    i have a VI with ~5 controls on it.
    And with the Object "Current VIs path" and "Open VI reference" i can create a reference to the current VI.
    How can i create now a reference to the controls? (Starting with VI-reference?
    Of course i know how to create directly a reference from a control.
    My idea wasm that there areperhaps properties like:
    - Number of controls
    - Name of control
    - Type of control (string, bool. number...)
    Is this somewhere there and i just dont find it?
    Thanks for your help

    Once you have the VI Refnum, it's a two-step process. Wire the VI Refnum into a property node and get a reference to the Front Panel. Output the Front Panel reference into another property node and select the property Controls[ ], which outputs an array of references for all the controls on the front panel.
    Message Edited by Jarrod S. on 04-20-2007 11:06 AM
    Jarrod S.
    National Instruments
    Attachments:
    get_ref.PNG ‏5 KB

Maybe you are looking for