LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Obtain references of items inside an XControl

Solved!
Go to solution

I'd like to build a property for an XControl in order to get the references of the controls in the facade front panel, something like the cluster "Controls[]" property.

I tried to get the references from the facade and pass them to the main VI through the Display state and a property to read the values, but when I pass the refereces obtained in this way to a property node I get an error 1055 saying that the object reference is invalid.

 

Thanks

0 Kudos
Message 1 of 11
(3,777 Views)
Solution
Accepted by topic author Daniele88

hi daniele88,

unfortunately i don't konw the answer to your problem,

but may i suggest putting a minimal version of your problem in code

and link it here, that might help ppl troubleshooting

(in case it is not something obvious why it wont work)

 

the only thing i can suggest off the top of my head,

is to make sure you have the "data changed" or "state changed" set "correctly"

so the information is properly stored, to be accessed by the xcontrol-property

 

but that might not be it.

 

good luck


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
Message 2 of 11
(3,759 Views)

I have attached a small project with just the XControl, the typedef and a test vi.

0 Kudos
Message 3 of 11
(3,744 Views)
Solution
Accepted by topic author Daniele88

Elements in the state cluster are only saved if the State Changed boolean is changed to true, like jwscs said. I would suggest moving the bundling into the Display State Changed event and then also writing true to that element. A quick test shows that this works.

 

That said, you should consider whether you really want to expose reference to internal controls. The whole point of XControls is to hide the implementation. It might be preferable to add the relevant methods or properties to the XControl itself.


___________________
Try to take over the world!
Message 4 of 11
(3,734 Views)

Yes, what tst said...

LabVIEW is disallowing an operation you should not be wanting to do anyway. I know that it might seem like a good idea, but shortcuts like this will always end up biting you in the end.

Mike ..

PS: Come to think of it, that last sentence could be read in two ways -- and they are both correct!


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 11
(3,714 Views)

Thank you very much; as you can imagine, I am quite new at using XControl. I am building one because I want to implement some extra features into my control (like updating all the spectrometers when I set a global parameter, or the drop down menu to select the spectrometer page in the tab control) but i still want to be able to read the values programmatically.

 

Another problem I stumbled upon is the fact that when I put a XControl class type specifier inside my block diagram, XControl VIs become locked as if I have a VI with the XControl on the front panel opened. The strange thing is that all the other classes private data controls becomes locked too: is there a way to avoid this (annoying) behaviour?

0 Kudos
Message 6 of 11
(3,655 Views)
No. The point to remember is that an XControl start executing as soon as they are installed on a front panel.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 11
(3,648 Views)

Another problem I stumbled upon is the fact that when I put a XControl class type specifier inside my block diagram, XControl VIs become locked as if I have a VI with the XControl on the front panel opened. The strange thing is that all the other classes private data controls becomes locked too: is there a way to avoid this (annoying) behaviour?

 

with a right mouse click in the Project Explorer on the correct XControl you can "detach" and after coding "reattach" it.

the terms might be different i dont konw atm


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
Message 8 of 11
(3,627 Views)
Solution
Accepted by topic author Daniele88

-- couldnt edit my other post --

 

if you run your main.vi (which contains the xcontrol(s))

a red lock symbol appears on the then running xcontrols.

 

right click --> "unlock library for editing"

(and/or read "why is library locked?)

 

after editing

 

right click --> "apply changes to instances"

 

good luck


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
Message 9 of 11
(3,619 Views)

jwscs ha scritto:

if you run your main.vi (which contains the xcontrol(s))

a red lock symbol appears on the then running xcontrols.

 

right click --> "unlock library for editing"

(and/or read "why is library locked?)

 

after editing

 

right click --> "apply changes to instances"



THANK YOU very much! That's the kind of trick that should be engraved in marble and shown to everyone (at least everyone that is building an XControl). It was really annoying to have to close al the VI with the XControl every time i needed to edit the XControl, and the class type specifier problem was driving me mad.

0 Kudos
Message 10 of 11
(3,604 Views)