PiDi Posted December 28, 2015 Report Share Posted December 28, 2015 I have a refnum control on my Front Panel and I want to change its class. Easy (well, if you don't count four "wait-for-menu-open" moments in process) to do manually Problem: How can I do it programatically? This is as far as I got with this - I was sure there would be some property/method of LVObjectRefNum class to do it, but I was wrong: I've attached the project with this VI for the convenience ChangeRefnumClass.zip Quote Link to comment
Darren Posted December 30, 2015 Report Share Posted December 30, 2015 I don't know of a way to do this. If somebody else does, please post here, as it's a gap in the functionality of the Quick Drop VI Server Rename shortcut (ships with LabVIEW 2010 and later) that I'd like to fill. Quote Link to comment
PiDi Posted December 30, 2015 Author Report Share Posted December 30, 2015 I've got the workaround: 1. Create ClassSpecifierConstant on block diagram - this one has SetType method. 2. Change it to control. 3. Now that you have the control with desired type, replace old control. It's a bit more wiring than those three points, so I'm just attaching the project with this implementation. ChangeRefnumClass.zip Quote Link to comment
ShaunR Posted December 30, 2015 Report Share Posted December 30, 2015 (edited) Control Refnums don't really work like that. It is a container that assumes the type of the contents a bit like ,NET and ActiveX containers rather than LabVIEW objects, per se. So you have to do something like this. You will notice that by inserting the control into the reference; the reference now assumes the [type] name of the control. ChangeRefnumClass Folder.zip Edited December 30, 2015 by ShaunR 1 Quote Link to comment
PiDi Posted December 30, 2015 Author Report Share Posted December 30, 2015 @Shaun: Nice catch, I didn't though of refnums as containers - now it seems pretty obvious (I forgot I can drop control on the refnum to change its type). However, there are two problems with the code on your screen: 1. The "style" input of New VI Object is a mess. I want to provide Class Name and nothing else, so I'd have to somehow decide how to translate the Class Name to style. I can think of couple of ways to do it, all of which would probably require a lot of coding. 2. This only allows to create GObject references. This is quite OK, because that's what I need for now, but my method allows me to create any type of reference (like ProjectItem, or Panel). Quote Link to comment
ShaunR Posted December 30, 2015 Report Share Posted December 30, 2015 @Shaun: Nice catch, I didn't though of refnums as containers - now it seems pretty obvious (I forgot I can drop control on the refnum to change its type). However, there are two problems with the code on your screen: 1. The "style" input of New VI Object is a mess. I want to provide Class Name and nothing else, so I'd have to somehow decide how to translate the Class Name to style. I can think of couple of ways to do it, all of which would probably require a lot of coding. 2. This only allows to create GObject references. This is quite OK, because that's what I need for now, but my method allows me to create any type of reference (like ProjectItem, or Panel). I see no problems. Only a solution to the question asked and the beginning of other solutions 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.