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

cancel
Showing results for 
Search instead for 
Did you mean: 

Unique ID for all front panel object

Solved!
Go to solution

Hi,

 

I am a seasoned LabVIEW developer (+20yrs), and for my current project, I have to make a multilingual GUI.

I've done this in the past, by displaying the caption of front panel controls and indicators, and changing this caption programmatically, based on the label text.

However, this approach (based on the label) has its disadvantages : it does not allow you change static texts on the front panel (as it does not have a diagram counterpart). Also I get in trouble when objects might have the same label name.

 

So now what I did was this : By getting the VIs Server "Front Panel"-ref property from a VI, and then getting the "Controls[ ]"-property from this front panel, I get a list of references to all front panel objects (including static texts). Each green refnum, I can typecast it to a U32! So I have unique ID's for each front panel object.

 

In my database, I then store all translation data, linked to this unique U32 number.

I tested that on exiting Labview and restarting the Labview application, the U32 values remained the same. They did, my ID's were remanent/persistant. Hurray!

 

However now after completely writing this language module, I see that the U32 refs have changed after all, probably when saving/recompiling from LabVIEW 2019 32-bit to LabVIEW 2019 64-bit.

 

Anybody have any tips to get a permanent GUID to each front panel object?

0 Kudos
Message 1 of 29
(1,888 Views)
Solution
Accepted by topic author ThomasV

Hi Thomas,

 


@ThomasV wrote:

Anybody have any tips to get a permanent GUID to each front panel object?


With scripting enabled you get additional properties for all FP elements: one of them is a (G)UID!

Read the help

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 29
(1,860 Views)

Wow, that's excellent!!!

 

Now I hope that these are persistent when recompiling a VI.

Will check it out immediatly

0 Kudos
Message 3 of 29
(1,843 Views)

@ThomasV wrote:

 

Now I hope that these are persistent when recompiling a VI.


Yes, UIDs are unique, and persist for the lifetime of the object, across saves, compiles, VI copies, etc.

Message 4 of 29
(1,799 Views)

Hi GerdW,

what do you mean with the sentence "With scripting enabled"?

How do I enable scripting? How do I use?

How do I get the UID property?

Thanks

0 Kudos
Message 5 of 29
(1,339 Views)

Hi Pinco,

 


@PincoG wrote:

Hi GerdW,

what do you mean with the sentence "With scripting enabled"?


In older LabVIEW versions you had to use a (more or less) secret INI key to enable scripting features.

Since several years there is a checkmark in the LabVIEW options to enable scripting, it's located in the VI server tab…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 29
(1,334 Views)

I'm trying to reproduce this code, extracting a ref for each control, but I see very few controls.

Maybe I'm loosing controls nested into containers. 

Is that what I'm loosing, isn't it?

How can I find also controls that stay inside tab?

0 Kudos
Message 7 of 29
(1,311 Views)

Hi Pinco,

 

each container (tab, cluster) has a property to get access to the contained controls…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 29
(1,305 Views)

You can use the Traverse for GObjects VI, which will recurse into containers to retrieve nested objects. I prefer that approach to having to do the parsing myself with the properties Gerd mentioned.

0 Kudos
Message 9 of 29
(1,292 Views)

Thankyou to everyone answered to this post.

I'm really near to the end solution.

Now I have to complete the backward path.

How can I obtain a reference from a number, to change some properties, caption, programmatically?

Thanks again

0 Kudos
Message 10 of 29
(1,260 Views)