Jump to content

XControl Hierarchical properties


Ton Plomp

Recommended Posts

This post has the beta version of the "XControl Hierarchical Property" creator

Alpha is found here

(that thread also discusses the need for Hierachical properties

A screenshot:

post-2399-1168457645.png?width=400

The code:

Download File:post-2399-1168457690.zip

The main VI is called:

GenerateProperties\GeneratePropsMethsMainVI.vi

You will get a warning two VIs are missing, they are located under the LabVIEW 8.2 directory, at the location of the vi in the code the path to the vi is given!

You will need a special XControl:

Download File:post-2399-1168457877.zip

Which is slightly modified, the state.ctl has an array of control references! and the time-out of the facade vi will load the references into the control!

This XControl is rather big, but it has 48 property VI's already created.

Have fun and please give some feedback!

If you have some errors inside the XControl, save the xcontrol and close it and then reload it into memory.

Ton

PS Thanks Micheal for the ':'

Link to post

I ran it on my machine and it works great! Excellent work. :thumbup: Yet again, another case study in the argument for opening up VI scripting to the masses.

...Which is slightly modified, the state.ctl has an array of control references! and the time-out of the facade vi will load the references into the control!
Can you explain how this would work a little bit more? I didn't see this implemented anywhere in your template. Is this a manual edit step in the process?

In general, you shouldn't do real work in the timeout case but perhaps this is the only way.

Link to post
In general, you shouldn't do real work in the timeout case but perhaps this is the only way.

I believe it is (unfortunately), let me explain.

An XControl property VI (Prop.VI) has no knowledge about it's facade VI beside the display state in. So you need to get the reference to the facade controls from the facade VI into the Prop.VI.

There are just 2 interfaces: "Container State" and "Display State In". The "Container State" has a reference to the instance of the control on the owning VI, not what we need. "Display State In" is configurable as you want. So I added a cluster member called "XCTRLRefs", this is an array with all the references I need for my custom properties.

I identify the Array members by the label.text property:

post-2399-1168499348.png?width=400

So I'll need the control reference in the "Display State In", this should be done inside the facade VI.

Now I need to be sure that always the references are loaded into memory, the issue is that documentation about the working of XControls is (to say the least) sloppy.

When does which event occure?

I need the event that happens when:

The XControl is executed (eg. the containing VI is running), but I'm not sure the "Exec State Change" when a VI is loaded into memory and runs directly.

I only know one event that covers this:

"TimeOut", so.... I use this:

post-2399-1168500432.png?width=400

(oh, I see the Facade VI I added was not correct, it missed this piece of code, please update)

Ton

Link to post
I need the event that happens when:

The XControl is executed (eg. the containing VI is running), but I'm not sure the "Exec State Change" when a VI is loaded into memory and runs directly.

I only know one event that covers this:

"TimeOut", so.... I use this:

post-2399-1168500432.png?width=400

Have you tried this? Does it work? The reason why I'm asking is because in order for you to use the references from within the Property nodes, you have to set State Changed boolean to TRUE every time you update the references from within the Timeout case.
Link to post
Have you tried this? Does it work? The reason why I'm asking is because in order for you to use the references from within the Property nodes, you have to set State Changed boolean to TRUE every time you update the references from within the Timeout case.

Hopefully you misunderstood me :(

In the property VI I use the XCTLRefs array to get a valid reference to the control inside the XControl.

In order to get the reference there I use the Display State Change. To load them into the Display State Change I use the shown snippet in the time-out case.

I got the feeling you thought I used it the other way round, am I right?

So I am not updating the display state changed, and I don't have to set the State Changed to true. I have used it on some simple properties, but it is not fully tested.

If the property couldn't locate the right control it will give an error saying which it found. Sometimes it just found nothing.... :headbang:

When I get the methods right (haven't started yet) I'll probably start with a tree control and tables because if you resize them the collumns visible change ahhhhhh

Ton

Link to post

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.