Jump to content

Experimenting with XControls and drag 'n drop


Recommended Posts

Attached is a demo of an XControl I constructed that allows the user to edit an ordered list of items using drag 'n drop. This is something that would have come in handy in several old projects. Source code included. It's great how an XControl behaves like a typical control including local variable, its own custom properties and methods, and value-change event.

What do you think of XControls? I think it's a neat, compact way to package what I could have done with a nice library of subVIs. It will occasionally be useful, I think. I would have liked to see better documentation. How and why the 'state' of the XControl is saved is not clear to me, and this involves the Init ability/VI (with its backward-compatibility bit of code) and the Convert State For Save ability/VI.

I notice that the description of my method VI appears as the context help for that method in an Invoke Node, which is great for making the XControl useable for programmers. But I can't figure out how to put text in the context help for properties in a Property Node.

Thanks for reading!

NOTE: In Labview version 8.0, this XControl does not work in a built EXE. Enjoy it in the full development environment only -- until the patch version comes out!

Download File:post-3297-1133036946.zip

Link to comment
  • 3 months later...

Yay, LV 8.0.1 came out today! I've verified that the above original demo VI and XControl work correctly as a built EXE in 8.0.1.

In the above post I wrote

How and why the 'state' of the XControl is saved is not clear to me, and this involves the Init ability/VI (with its backward-compatibility bit of code) and the Convert State For Save ability/VI.

Can anyone shed some wisdom on that subject? Thanks.

Link to comment
  • 2 weeks later...

Ryan King of NI answered my questions: :)

"Actually, the state is saved automatically whenever you save a VI that is using the control. The state is saved with the VI, not in an external file. Saving the state of a control is absolutely necessary for making the control behave like other LabVIEW controls. For example, when you set the properties on a waveform graph, save your VI, close it and re-open it, the properties are still set. Saving the state of an XControl allows it to have the same functionality.

"The Convert State For Save ability allows you to modify the state before saving it to disk. Typically this is done to remove any nonpersistent information that you might have stored in the state, such a references or local data storage (for example, in an XControl I'm writing, I have an item in the state to indicate whether the mouse is currently depressed and over the XControl, this information wouldn't be meaningful the next time I load a VI using the XControl, so I may as well remove it from the state before saving to save space in the disk footprint)."

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.