Jump to content

Probes of Classes with XControls


Recommended Posts

Ok, I've discovered a new way to shoot myself in the foot while programming in LabVIEW. Here's how you do it:

1) Create yourself a LabVIEW class

2) Create yourself an XControl to display your new class doing some nifty processing to prettyify your class's private data

2b) Note that you can't add your XControl to your class, so use some public methods to extract the private data

3) Decide you want a probe for your class, so create it and figure "why not just use my nice shiny XControl in my probe ?"

4) Add your probe to your class so that you can assign it in the class properties. Don't forget to save your class as soon as you have added the probe !

5) Notice that your class is now locked. Enjoy that sinking feeling as you realise this means you can't remove the probe and undo whatever damage it is that you have just done. Find a nice text editor and get hacking on the XML file that defines the class. :headbang:

I think the problem is that when a VI containing an XControl is added to a project, the XControl is loaded. creating a new application instance, which contains an instance of your class. Your class is now loaded in two application instances and is therefore locked.

Link to comment

QUOTE(Gavin Burnell @ Nov 11 2007, 10:33 PM)

Don't forget to save your class as soon as you have added the probe !

5) Notice that your class is now locked. Enjoy that sinking feeling as you realise this means you can't remove the probe and undo whatever damage it is that you have just done. Find a nice text editor and get hacking on the XML file that defines the class. :headbang:

Source Code Control?

Ton

Link to comment

QUOTE(tcplomp @ Nov 12 2007, 04:36 PM)

Source Code Control?

Ton

Of course, or just a versioning file system so I didn't need to remember to do a commit after every save... oh for the days of VAXen and VMS ;)

Semi-seriously, has anyone else had problems with generating corrupt xml files when LV tries to handle non-unique filenames in multiple directories (like dir.mnu for example) - quite often I seem to get an XML file that has multiple entries for dir.mnu that originally pointed to different directories, but at some stage get set to all point at the same file. LabVIEW then decides my library/class is corrrupt and won't load it. A quick go with {CVS|SVN} Diff and a merge editor (I like WinMerge myself) sorts out the mess, but I wish I could work out what triggers this and how to stop it.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.