Bingo Posted September 25, 2007 Report Share Posted September 25, 2007 I have a string control on the facade.vi,and now I want to use this string control by it's refum(in init.vi).Is there anybody can help me? Thanks. Jack. Quote Link to comment
Ton Plomp Posted September 25, 2007 Report Share Posted September 25, 2007 QUOTE(Bingo @ Sep 24 2007, 05:52 AM) I have a string control on the facade.vi,and now I want to use this string control by it's refum(in init.vi).Is there anybody can help me? Hi Jack, what I would do is use some messaging, the init state triggers the 'Display State Change' event int the facade VI. The init VI should only be used to load the previous run information and allocate some resources. What is it that you whish to do? Ton Quote Link to comment
Bingo Posted September 25, 2007 Author Report Share Posted September 25, 2007 QUOTE(tcplomp @ Sep 24 2007, 12:12 PM) Hi Jack,what I would do is use some messaging, the init state triggers the 'Display State Change' event int the facade VI. The init VI should only be used to load the previous run information and allocate some resources. What is it that you whish to do? Ton Hi Ton Thanks for your help.What I'm going to do is to pass this refum of the string to a reentrant subvi,and make this subvi run in background,which would always change this string control'state,such as change the color every 1s(blinking).So the string control would always change its color no matter in run model or edit model .And at the end I would terminate the subvi in uninit.vi. This idea comes from a blog of someone,but without the detail. Is this possible?Or would you have an other method? Jack Quote Link to comment
LAVA 1.0 Content Posted September 25, 2007 Report Share Posted September 25, 2007 An example of how to update an XControl continiously was created by Aristos and is available from the NI web site. http://community.ni.com/examples/scrolling-led-xcontrol/ There may be other ways to do it, but this would be a good starting point. Quote Link to comment
gb119 Posted February 28, 2008 Report Share Posted February 28, 2008 A somewhat similar problem, only this time I think I want to mess with the refnum in the user program - why on earth do I want to something quite this dum ? Well I've been playing with making an XY plot with error bars XControl (why oh why hasn't NI provided a native version yet ? Don't people believe in error bars when looking at real data ?) and I'm too darn lazy to try and write wrappers to export all the properties of the standard XY Graph control, so I thought I could save time by just exporting the refnum to the XY graph on the facade... Ok, well I worked out that the facade is running in a separate application instance, so you can't just stuff the Control refnum into the state cluster and then read it with a custom property. I worked around this by storing the "This application" refnum into the state cluster from the facade, and then in the read property code, opening a reference to my facade vi in that particular application instance and then getting a reference to the correct control and passing that back. Now I can get/set properties on my XY Graph Control, but I can't get the XControl on my application vi to update its appearance. Curiously, if I unload and reload my application then the XControl has picked up the new settings, so I do change something, but it's not exactly runtime behaviour.... Any thoughts (other than to (a) not be so stupid and to stop trying to do things which were never designed to work or (b) suggest that NI give us a proper XY with error bars graph control) ? Quote Link to comment
Ton Plomp Posted February 29, 2008 Report Share Posted February 29, 2008 QUOTE(Gavin Burnell @ Feb 27 2008, 11:27 PM) A somewhat similar problem, only this time I think I want to mess with the refnum in the user program - why on earth do I want to something quite this dum ?Well I've been playing with making an XY plot with error bars XControl (why oh why hasn't NI provided a native version yet ? Don't people believe in error bars when looking at real data ?) and I'm too darn lazy to try and write wrappers to export all the properties of the standard XY Graph control, so I thought I could save time by just exporting the refnum to the XY graph on the facade... Ok, well I worked out that the facade is running in a separate application instance, so you can't just stuff the Control refnum into the state cluster and then read it with a custom property. I worked around this by storing the "This application" refnum into the state cluster from the facade, and then in the read property code, opening a reference to my facade vi in that particular application instance and then getting a reference to the correct control and passing that back. Now I can get/set properties on my XY Graph Control, but I can't get the XControl on my application vi to update its appearance. Curiously, if I unload and reload my application then the XControl has picked up the new settings, so I do change something, but it's not exactly runtime behaviour.... Any thoughts (other than to (a) not be so stupid and to stop trying to do things which were never designed to work or (b) suggest that NI give us a proper XY with error bars graph control) ? To get the reference of the owning control, it's available in the Container State. To import a subset of properties of a part of the properties use this http://forums.lavag.org/downloads-file74.html' target="_blank">tool Ton Quote Link to comment
gb119 Posted February 29, 2008 Report Share Posted February 29, 2008 QUOTE(tcplomp @ Feb 28 2008, 05:13 AM) To get the reference of the owning control, it's available in the Container State.To import a subset of properties of a part of the properties use this http://forums.lavag.org/downloads-file74.html' target="_blank">tool Ton Hmmm, I tried the XControl Inheritence tool, but it's not working for me. Specifically, it creates the properties all ok, but whenever I try to access those properties, I get a control 'XXX' not found, error code 1 message. Looking at the generated code I see 2 potential problems: 1) The technique seems to rely on stuffing a constant reference to part of the XControl into the state variable in the facade and then using that reference in the property read/write code. Now, the facade is running in one application instance and the property node code is running in the main application instance and you can;t use a refnum from one application instance in another. I wonder if this is behaviour that changed between LabVIEW 8 and 8.2.1 (which I'm testing in, although the same problem does happen in 8.5 'cos my attempts hit this same problem). 2) I don't follow why the generated code is looking for the label.text property of the stored refnum to be equal to the name of the property that I'm trying to access - surely the label.text property will (should, see 1) above) return the label of the part of the XControl that I'm inheriting and not have any knowledge of the name of the property. Apologies if I'm being terminally stupid here - :headbang: Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.