LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace Class Control of Non-Disk-Saved Class

[LV2009, Win 7 Ult]

Calling all Scripting Ninjas...

Does anyone know how I can Replace a control with the Class Control of class that is not saved to disk?

If I use the standard Replace method I need to specify a Path but the Class is not yet saved to disk.

I had a go with the below code, but the ReplaceWithControlOfOtherClass method crashes LabVIEW when it runs (confirmed with Disable node) on my PC.

replaceClassControl.png

What is the standard way to do this?

Does the ReplaceWithControlOfOtherClass method work for other people?

Cheers

-JG

<edit>

I just tested this node in a VM running LV2009 and Win XP and LabVIEW crashed as well.

Any ideas?

</edit>

Message was edited by: Jonathon Green

Certified LabVIEW Architect * LabVIEW Champion
0 Kudos
Message 1 of 7
(6,725 Views)

I could not find anything, and don't know anything off the top of my head, but you could use the old way we used back when scripting was very new and only half implemented - drop the new item, move it over the old one, connect the old to the new, then delete the old.  You will need to worry about the following:

  1. Front panel position
  2. Block diagram position
  3. Connection of block diagram terminal
  4. Creation and connection of any locals
  5. Creation and connection of any property nodes
  6. Replacement of any references
  7. Connection to connector pane

You will not be able to fix event structure issues, but you probably are not using class controls in the event structure, so this is probably a non-issue.  I would recommend saving the object and then using it.  Much easier.  You can delete the code on disk or save to a different location at a later time.

Message 2 of 7
(3,679 Views)

Thanks DFGray for the fast reply!

How to I add a Class Control for a Class to a VI without using the path?

This is the current way I know how

1.png

LabVIEW must do it somehow when it creates a new Static or Dynamic Template?

I don't want to save the Class, I want the User to save the Class after I do the scripting.

Cheers

-JG

Message was edited by: Jonathon Green

Certified LabVIEW Architect * LabVIEW Champion
0 Kudos
Message 3 of 7
(3,679 Views)

You can do it.

ReplaceClassCtrl.png

0 Kudos
Message 4 of 7
(3,679 Views)

Thanks Steve

I thought this maybe the case, but as per my original post this node keeps crashing LabVIEW on me.

I was working in LV2009, I even tried LV2010 (as per you screenshot) but that crashed to!

Would you have any example code for me to run to test?

Maybe how I am using it is killing LabVIEW?

Cheers

-JG

Message was edited by: Jonathon Green

Certified LabVIEW Architect * LabVIEW Champion
0 Kudos
Message 5 of 7
(3,679 Views)

You prompted me to do it. I just uploaded these. You're welcome.

http://decibel.ni.com/content/docs/DOC-13196
http://decibel.ni.com/content/docs/DOC-13195

And the specific file that you're interested in is

CLSUIP_ReplaceLVClassControls.vi

Message 6 of 7
(3,679 Views)

Extending Kudos from LAVA to here!

Cheers

Certified LabVIEW Architect * LabVIEW Champion
0 Kudos
Message 7 of 7
(3,679 Views)