Jump to content

"Select VI Server Class" on Refnum Control programatically


PiDi

Recommended Posts

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

post-50361-0-44145700-1451340407.png

 

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:

post-50361-0-78041900-1451340834.png

 

 I've attached the project with this VI for the convenience  ;)

ChangeRefnumClass.zip

Link to comment

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.

 

post-15232-0-99013600-1451509388.png

 

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 by ShaunR
  • Like 1
Link to comment

@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).

 

 

Link to comment

@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 :)

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.