Jump to content

Set property by name -- possible?


Jim Kring

Recommended Posts

Does anyone know an easy way to set a property by name? For example, if there were a VI Server App method that took an object reference, property name, and property value as arguments.

Thanks,

Hi Jim,

I know Jeffrey has done something like this in scripting. I used scripting in my XControl Inheritance property thingy.... (I think I need to come up with some official name),

I'll add the related files:

Download File:post-2399-1169442833.zip

You probably need to modify the template path (and the templates if you want to make them usefull)

Ton

Link to comment

Ton,

Thanks for this. I was hoping for something with a little less extra baggage (VITs, etc.) I'm working on OpenG Builder and I'm coding in LabVIEW 6.1 and I need to set an Application Property in LabVIEW 8.2. The current solution is to make dynamic calls to a VI that is written in LabVIEW 8.2 that calls the specific property in property node.

Thanks,

-Jim

Link to comment
Ton,

Thanks for this. I was hoping for something with a little less extra baggage (VITs, etc.) I'm working on OpenG Builder and I'm coding in LabVIEW 6.1 and I need to set an Application Property in LabVIEW 8.2. The current solution is to make dynamic calls to a VI that is written in LabVIEW 8.2 that calls the specific property in property node.

Thanks,

-Jim

My solution is quite dynamic, in your case (I think I know which property you need :D ), you could streamline the amount of code, but I don't think you can't change it on runtime, so you'll need the dynamic calling anyway. And does the target reference type exist in LV 6.1?

Ton

Link to comment
Ton,

Thanks for this. I was hoping for something with a little less extra baggage (VITs, etc.) I'm working on OpenG Builder and I'm coding in LabVIEW 6.1 and I need to set an Application Property in LabVIEW 8.2. The current solution is to make dynamic calls to a VI that is written in LabVIEW 8.2 that calls the specific property in property node.

Thanks,

-Jim

I have the same issue for many of our applications/toolkits and had been doing the same thing. However, for our Icon Editor I have tried something new, let the installer do the work for you. The installer (or Package Manager) will install the 6.1 code (in your case), then detect the version of LV and write over specific files with replacement files of the same name but written in another version of LV.

I am looking forward to an update to the Builder! I will review my 8.0 and 8.2 modifications and see if there is anything I should let you know about.

Brian

Link to comment
My solution is quite dynamic, in your case (I think I know which property you need :D ), you could streamline the amount of code, but I don't think you can't change it on runtime, so you'll need the dynamic calling anyway. And does the target reference type exist in LV 6.1?

Ton,

I am trying to setting the Application property named "Run Reserve XI Components". Setting this to FALSE, causes XNodes and XControls to be loaded without running the eXternal Interface (XI) (i, the Facade VI of an XControl). This avoids the problem (er... feature) in LabVIEW 8.2 where you cannot perform a Save As on running VIs.

The "Run Reserve XI Components" property was introduced in 9.2, so it doesn't exist in 6.1, unfortunately.

Thanks,

I have the same issue for many of our applications/toolkits and had been doing the same thing. However, for our Icon Editor I have tried something new, let the installer do the work for you. The installer (or Package Manager) will install the 6.1 code (in your case), then detect the version of LV and write over specific files with replacement files of the same name but written in another version of LV.

I am looking forward to an update to the Builder! I will review my 8.0 and 8.2 modifications and see if there is anything I should let you know about.

Brian,

I think that this solution (packaging up a LabVIEW version support library) would work. I'll think on this and post back with my results, if I go this route.

Yes, if you have any feedback for 8.x, we would love to hear it. Currently, the support for all the new stuff (XControls, XNodes, Project Libraries, LVClasses, External Nodes, etc.) is a little sparse.

Thanks,

Link to comment
Does anyone know an easy way to set a property by name? For example, if there were a VI Server App method that took an object reference, property name, and property value as arguments.

You can do it by index. But then you have to hunt down the proper index....... :ninja:

post-1519-1169489137.gif?width=400

I would assume that the indices don't change from version to version, but I also assume that is not a safe assumption.

David

Link to comment
This looks like it could work well for GObjects, however, I'm trying to set a property on an Application reference.

If the Application class does have this method and it's simply not exposed, I'm wondering whether type casting it to the generic class would do the trick?

Of course, you would need to find the property indexes to test this, and attempting to automate this crashes my copy of LV, but I'm fairly sure I saw a list of indexes around here somewhere (maybe Brian posted it?).

Link to comment
This looks like it could work well for GObjects, however, I'm trying to set a property on an Application reference.

Jim,

You are right. I forgot when I played with this that I couldn't get it to work for a VI property. It also crashes LV for me when I try to typecast the App to a GObj and use it.

Regarding a list of property indices, there was a post where I requested such a list Here. I never heard from anyone so I started compiling a list. I never finished, nor did I get very far.

Link to comment
Jim,

You are right. I forgot when I played with this that I couldn't get it to work for a VI property. It also crashes LV for me when I try to typecast the App to a GObj and use it.

Regarding a list of property indices, there was a post where I requested such a list Here. I never heard from anyone so I started compiling a list. I never finished, nor did I get very far.

Hi dsaunders:

you can get the index of any, even private property.

(1) Create a property node (e.g. Panel:SelList[])

(2) Create an indication for this property

(3) Finally call GetPropertyCallData linked to any control/indication

Unfortunately this works only for Generics and I can not add a picture to this reply.

Link to comment
David,

This looks like it could work well for GObjects, however, I'm trying to set a property on an Application reference.

Thanks,

This doesn't solve your specific problem because you're using LV 6.1, but there's a roundabout solution to the problem in general using LabVIEW 8.x, .NET 2.0 or higher and Iron Python, the .NET flavor of Python. It's all described here on Brian Tyler's blog. It involves wrapping the ActiveX server for LV into a .NET assembly, then loading that assembly in Iron Python. The advantage is that Python is a dynamic language and doesn't require precompiled code. So you can dynamically execute actions such as setting properties of LabVIEW objects.

I realize it's not sufficient for your needs, but it's pretty cool!

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.