LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XControl strict reference

I have an XControl and I'd like to be able to launch a configuration VI asynchronously which calls methods and sets / reads properties of the XControl for configuration.

 

I can create a strict reference to the XControl (Control, not library) on the sub-VI.  I can then wire this reference to an Invoke node and invoke the XControl methods or access the XControl properties.  So far so good.

 

But then I wanted too much.  I wanted to launch this VI asynchronously from within the XControl itself (right-click menu - Configure).  Here is the problem.  I have NO strict reference to the control itself.  I can try to get the control reference from the FP of the owning VI but it is NOT strictly typed.  I don't know if a "cast to more specific" will work in the sub-VI.  I'm currently trying it out.

 

Once I start trying to do things like this, LV regularly crashes on me.  I'm clearly doing something which is beyond the defined scope of XControls and something somwhere is getting very upset about what I'm trying to do.

 

What to do?  Shouldn't we be able to get a strictly-typed reference to an XControl Control (as opposed to the Library) within the facade VI?  If not, why not?

 

Shane.

0 Kudos
Message 1 of 8
(2,590 Views)

OK, it doesn't work.

 

The type information for the control disappears once I save and re-open the code.  The created controls used to store the strict reference default back to "generic" as soon as this happens.

 

In addition, LV seems to not like this situation.  I've sent a report 6996b191-e4e5-4706-a950-3633f840fac7 which contains warnings when I exit LV after trying this.  I also got a nice old-fashioned crash : a7f4d275-2a60-4665-8bbf-e7ea0e26737d

 

Is there some superdupersecret way to get a strict control reference to an XControl from WITHIN the XControl?  Even a way to make such a control maintain it's type?  I think it could be a new addition to the container state.

 

On the other hand, in order to achieve the same functionality in a different way, is there some way of giving an asynchronous VI the ability to call built-in methods and properties of a given XControl?  I assumed the path via a strict reference to the XControl would work.

 

Shane.

0 Kudos
Message 2 of 8
(2,582 Views)

So a bit of an explanation to my madness:

 

I have some configuration options in my XControl which alter the appearance of the XControl directly.  I would like the user to be able to make these changes and have a live preview of the effects it would have on the control.  I thought launching an asynchronous process with a strict control reference would handle this just fine.  A different approach would be to implement the functions without a control reference as a standard pop-up VI within the XControl accepting the current config as an input and the new modified config as an output, but these changes then block the update of the XControl so that the user only sees the effects of the changes after making all the changes and closing the dialog.

 

Obviously I don't want to have to do this in the VI hosting the XControl but rather have it built into the XControl itself.

 

Any ideas?

 

Shane.

0 Kudos
Message 3 of 8
(2,576 Views)

Hello Intaris,

I had the same problem. I use LV2009 and found this solution:

  1. Create one strict typdef with configuration data
  2. Paste one instance (e.g. ConfigData) in facade.vi
  3. Create an event case for Config Data datachange.
  4. In the asynchronously running configuration VI define a reference control for ConfigData and initialize it at start up. e.g. with invoke node->Set Control Values.
  5. In configuration VI forward configuration changes via set value signalling to ConfigData
  6. In facade.vi event case You can set action.configuration changed = TRUE if needed and made changes at XControl behaviour
0 Kudos
Message 4 of 8
(2,463 Views)

Intaris, as always stretching LV features to limits Smiley LOL

Take a look at the attached project. The idea is to include one instance of the xcontrol inside the configuration.vi, so it will always be linked to this control. For some reason the xcontrol instance in configuration.vi sometimes gets broken, but when you open test.vi, everything works fine.

Inside the xcontrol look at the Config.Value Change event. There is a call to the subVI.

Message 5 of 8
(2,448 Views)

Could you save it in LV 2012?

Message 6 of 8
(2,406 Views)
Message 7 of 8
(2,401 Views)

That seems to do exactly what I'm looking for.

 

I never made the bridge between my strict references and an actual control to link the reference to.

 

Great answer, a Gigakudos if I could!

 

Shane.

0 Kudos
Message 8 of 8
(2,395 Views)