Milchbilch Posted December 17, 2008 Report Share Posted December 17, 2008 Hi, I am using LV8.6. I have created a LV class e.g. "ClassA". In a VI I can now manually create 10 Controls of type "ClassA" and create a Reference for each of these Controls. This is the way I usually create my references to objects (e.g. of type "ClassA"). I do work with these objects using call by reference methods, this works so far. But instead of this "manual reference creation" can I create references to objects of type "ClassA" by using something like an "Open class reference.vi" and typecast it to any of my classes? Just like the way like I can create VI References using "Open Vi Reference.vi" Any help is very appreciated! Best regards, Stefan Quote Link to comment
Francois Normandin Posted December 17, 2008 Report Share Posted December 17, 2008 QUOTE (Milchbilch @ Dec 16 2008, 04:25 AM) But instead of this "manual reference creation" can I create references to objects of type "ClassA" by using something like an "Open class reference.vi" and typecast it to any of my classes? Just like the way like I can create VI References using "Open Vi Reference.vi" Check out the "Cluster, Class & Variant Palette". You'll be interrested by these: http://lavag.org/old_files/monthly_12_2008/post-10515-1229436362.png' target="_blank"> Quote Link to comment
Milchbilch Posted December 17, 2008 Author Report Share Posted December 17, 2008 QUOTE (normandinf @ Dec 16 2008, 03:06 PM) Check out the "Cluster, Class & Variant Palette". You'll be interrested by these: http://lavag.org/old_files/monthly_12_2008/post-10515-1229436362.png' target="_blank"> Hmmm... with "Get LV Class Default Value.vi" I don't think that I can create a new object of e.g. type ClassA. I only read the standard values, don't I. Or is there a way to get a reference of each object that was created that way? This is what I really need. The same kind of reference I get like when I rightclick a control and create a reference to that control element. Stefan Quote Link to comment
Francois Normandin Posted December 17, 2008 Report Share Posted December 17, 2008 QUOTE (Milchbilch @ Dec 16 2008, 10:52 AM) Hmmm... with "Get LV Class Default Value.vi" I don't think that I can create a new object of e.g. type ClassA. I only read the standard values, don't I. Or is there a way to get a reference of each object that was created that way? This is what I really need. The same kind of reference I get like when I rightclick a control and create a reference to that control element. Stefan Using the "Get LV Class Default Value.vi" will create a new instance of your class. You can store a reference to this instance and refer to it elsewhere. But that's a tricky design: make sure you don't disrupt your dataflow... (Personally, I don't like this design: I think it's dangerously hard to debug especially if you start creating multiple instances. You might run into data collision pretty soon.) http://lavag.org/old_files/monthly_12_2008/post-10515-1229446300.png' target="_blank"> Quote Link to comment
Aristos Queue Posted December 17, 2008 Report Share Posted December 17, 2008 QUOTE (Milchbilch @ Dec 16 2008, 03:25 AM) But instead of this "manual reference creation" can I create references to objects of type "ClassA" by using something like an "Open class reference.vi" and typecast it to any of my classes? Just like the way like I can create VI References using "Open Vi Reference.vi" The "Open class reference" is a reference to your class. What you are looking for is a reference to your object that is an instance of your class. These are two very different things. No, there is no object reference built into LabVIEW. You have to do something that dynamically creates a data storage location. Your options include opening a new VI [either by duplicating a template or cloning a reentrant VI] which you could then use to store data either in controls [through the Value property] or in uninitialized shift registers [as per functional global] creating a queue or notifier of the desired type using some sort of global VI with an array of objects and adding a new position in the array etc... I'm sure there are more if you get creative The class reference is a reference to the .lvclass file itself. You can use it to query the class definition (who is my parent class, how many methods do I have, etc) and to do editing to the class (change wire appearance, etc). It does not give you a reference to an actual object. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.