AutoMeasure Posted November 26, 2005 Report Share Posted November 26, 2005 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 Quote Link to comment
AutoMeasure Posted March 8, 2006 Author Report Share Posted March 8, 2006 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. Quote Link to comment
AutoMeasure Posted March 17, 2006 Author Report Share Posted March 17, 2006 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)." Quote Link to comment
george seifert Posted March 20, 2006 Report Share Posted March 20, 2006 Thanks for posting your example. I started looking at Xcontrols when I first got LV8, but the documentation was so confusing (to my tiny brain anyway) that I gave up. It's nice to see another example that I can disect so I can try to make sense of all the components needed. George 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.