LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

TypedRefNum / DataValRefNum element replacement

I'm trying to create a DVR control and replace the element.

However, the Element.Reference property seems to be invalid at unless the FP control has been switched from "show icon" (default on creation) to "show control" at some point. After that has happened once, the element replace works regardless of the view mode. Does this perform some sort of initialisation?

Example below:

DVR.PNG

DVR creation.png

Is this behaviour expected?

Does it change to another data type when viewed as an icon?

Is there a way using scripting to change the display mode between the two?

I could create this using a template DVR control, but I'd like to know if it's possible from scratch.

Thanks



Using LV2018 32 bit

Highly recommended open source screen capture software (useful for bug reports).

https://getsharex.com/
0 Kudos
Message 1 of 8
(5,930 Views)

You should post this in the Scripting Community - you'd probably get a lot of answers.  I have done a bit of scripting and love it.  The hardest part is figuring out how to reference an item properly - you are halfway there with replacing the element on the DVR reference if shown.

I would think you should be able to manipulate the control through a reference.  If that is not available direcrtly you might be able to recreate the mouse functionality through mouse scripting.  I had to do that once on a similar project where the object property I wanted to change was not accessible in scripting and I knew it was on a Right Click Menu.

This is where I usually post scripting questions:

https://decibel.ni.com/content/thread/2952?start=0&start=0

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 2 of 8
(5,491 Views)

Ahh, I didn't realise there was a mega-thread for these questions . Thanks for the link.

I did a google search for LabVIEW scripting community before posting and the LabVIEW APIs community was the main hit.

Good to know that it's possible to invoke right click menu actions. I wasn't aware of this, so thanks, that may be the solution

I'll link to this discussion in the thread that you mention.



Using LV2018 32 bit

Highly recommended open source screen capture software (useful for bug reports).

https://getsharex.com/
0 Kudos
Message 3 of 8
(5,491 Views)

Yeah shame there isn't a Control>Show Icon? property that you can set through the reference. 

I think you might just be better off creating a custom template file with the Show Control style of DVR already created and use that to put down a new DVR.  Templates aren't horrible - even if we do want to be able to everything the elegant way through scripting, sometimes it isn't possible.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 4 of 8
(5,491 Views)

For Mouse Clicks: http://digital.ni.com/public.nsf/allkb/C5EDD606E6083DA1862573010001A5BD

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 5 of 8
(5,491 Views)

If you create the original DVR with a call to VI->CreateFromDataType() then the element can be replaced:

CreateandChangeDVR.png

Not sure why it is different.

Message 6 of 8
(5,491 Views)

Ah, I didn't realise it was the Windows API calls. I thought it may have been some LabVIEW specific calls which wouldn't require the window open. Useful to know however.



Using LV2018 32 bit

Highly recommended open source screen capture software (useful for bug reports).

https://getsharex.com/
0 Kudos
Message 7 of 8
(5,491 Views)

Huh good to know another method!  Thanks.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 8 of 8
(5,491 Views)