From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting with XControls

I'm progressing deeper into the depths of Scripting (Thanks NI BTW) and I have run into a little problem.

How does one identify a "Data" ability VI of an XControl as such?  I've managed to statically link to the different VIs by taking a specific index of the Children[] property, but that's not very robust.

When debugging, I can see which VI is the data VI, but I can't determine this programatically.....

I can get as far as labelling the VI as a Control within an XControl but since the State and Data VIs BOTH fit this description, how to distinguish?

Shane.

0 Kudos
Message 1 of 6
(4,633 Views)

After a lot of searching, this is the only mechanism that I could find:

DetectDataCtrlOfXCtrl.png

I built that icon constant by getting the icon for a known Data control once and then making it into a constant.

There may be a better way, but I couldn't find it.

0 Kudos
Message 2 of 6
(3,155 Views)

Thanks for the reply.  At least now I know that I wasn't just overlooking anything in my search.

I'm currently "getting around" the problem by assuming the first reference in the Children Array is the Data, the second the State, the third the Facade and the fourth the Init VI.

This also happens to be the order in the project explorer but I don't know if that order is forced or whether it just happens to work for my XControl.

Off to the LV Idea Exchange to make some suggestions.....

Shane.

0 Kudos
Message 3 of 6
(3,155 Views)

You can use C:\Program Files\National Instruments\LabVIEW 8.6\resource\framework\providers\xi\LIBUIP_Get_Ability_Name.vi.

It takes in a library refnum (xcontrol is a library) and a project item refnum and returns the ability name. It returns "Data" for the data control.

Ram.

0 Kudos
Message 4 of 6
(3,155 Views)

Cool, thanks.

Works well.

Can't we move this functionality into the core scripting suite via a Property node or something?

Shane.

0 Kudos
Message 5 of 6
(3,155 Views)

I'd like to use that "Unlock for Edit" XCTL invoke node, but I can't find it anywhere.  Do you know where its located?

0 Kudos
Message 6 of 6
(3,155 Views)