Jump to content
Sign in to follow this  
Michael Aivaliotis

XControl nested properties and help

Recommended Posts

I wanted to know if it's possible to create nested properties with XControls. See the built-in boolean properties as an example.

post-2-1166940345.png?width=400

Also, how do we create custom help so that when someone hovers over the custom XControl property node you can see help in the floating help window?

Share this post


Link to post
Share on other sites

So Michael asking questions.

First the easy one:

Use the description:

post-2399-1166964661.png?width=400

The container state contains the reference to the xcontrol

The second one looks more difficult, but fortunately not:

post-2399-1166965173.png?width=400

And here is some proof:

post-2399-1166965292.png?width=400

The help text is just the string, which originates from the numeric-data in a standard X Control

Now, Michael what are you going to do with this.

Hopefully a way to build an Xcontrol which has all the properties of normal LV controls, and this build with scripting?

Ton

Share this post


Link to post
Share on other sites

I'll clarify my question a bit more since your answer is not what I was looking for. If you open up the one and only Xcontrol example which ships with LabVIEW, you will see a custom property called: Fahrenheit Mode? Notice that it does not have any Context Help. How do we add help to this specific property?

post-2-1167011287.png?width=400

Now, you can add as many custom properties or methods as you desire. However, you can't add them in a nested fashion

post-2-1167011550.png?width=400

I hope this clarifies what I'm after.

Share this post


Link to post
Share on other sites
I'll clarify my question a bit more since your answer is not what I was looking for. If you open up the one and only Xcontrol example which ships with LabVIEW, you will see a custom property called: Fahrenheit Mode? Notice that it does not have any Context Help. How do we add help to this specific property?

I can't help with the nested properties question, but on the Context Help, I think you just set the Description for the VI that implements that property. Whatever is in that description shows up as the help for the XControl's property node.

Share this post


Link to post
Share on other sites
...on the Context Help, I think you just set the Description for the VI that implements that property. Whatever is in that description shows up as the help for the XControl's property node.
I tried that but it had no affect.

Share this post


Link to post
Share on other sites
I can't help with the nested properties question, but on the Context Help, I think you just set the Description for the VI that implements that property. Whatever is in that description shows up as the help for the XControl's property node.

Michael,

You can set the context help for properties and methods in an XControl from the XControl properties dialog.

post-906-1167049918.jpg?width=400

Share this post


Link to post
Share on other sites

Your question Michael reminds me of one XControls related question of mine that still is unasnwered. Is there a way to inherit properties and methods of build-in LabVIEW control to the properties of an XControl at least in a case where XControl front panel consits of only one built-in control. The idea would be to extend the functionality of built-in control in a much a same fashion as one can extend functionality of a OOP class. I haven't found a way to inherit these build-in properties and methods but maybe some LAVA readers have... :rolleyes:

Share this post


Link to post
Share on other sites
Your question Michael reminds me of one XControls related question of mine that still is unasnwered. Is there a way to inherit properties and methods of build-in LabVIEW control to the properties of an XControl at least in a case where XControl front panel consits of only one built-in control. The idea would be to extend the functionality of built-in control in a much a same fashion as one can extend functionality of a OOP class. I haven't found a way to inherit these build-in properties and methods but maybe some LAVA readers have... :rolleyes:

This was for me also the first feature I searched for when the XControl was introduced. Saddly it appeared not to be possible. It would indeed be nice to have this feature in the future for at least the XControls that have only one native control embedded.

For now, as a kind of workaround I just create a read property for the embedded native control's reference, which at least gives some kind of flexibility without having to re-implement common properties/methods.

Share this post


Link to post
Share on other sites
as a kind of workaround I just create a read property for the embedded native control's reference, which at least gives some kind of flexibility without having to re-implement common properties/methods.
This is the same solution I have come to as well. The problem however with exposing a reference to the end user is that this breaks encapsulation rules. There is the potential of messing around with elements that you want protected. I don't have a problem with re-creating certain properties. If only we could group related properties and use nesting then it would be one step closer. As it stands, you end up with a super long property list.

Share this post


Link to post
Share on other sites

Sorry I answered the wrong question, but if you look at how the original properties/methods are implied true inheritance is used.

Using the AllProps property of a string, there is no such property label.text or caption.text.

Just two references of the type 'Text', Is there a way for use to mimic this?

Ton

Share this post


Link to post
Share on other sites

Just a status update (or what have you done in the holidays?)

I can generate the first generation properties (read and write) (so just visible, label.text and othere subclasses not yet, though they are not that difficult)

I can add them (in some way) into the XControl, allthough I have mayor issues with the state typedef. My vit uses another one than the xcontrol and won't accept the new one....

I cannot generate the Methods (haven't looked int it)

Hopefully this friday I'll have it sorted out about the property creation into the XControl...

Ton

Share this post


Link to post
Share on other sites

Okay:

here it is the dynamic generation of XControl properties.

This first alpha version is somewhat limited:

  • You need a special state format (actually it needs a XCTL array of control references
  • You need a special facade vi (see the time-out case
  • Only creation of properties
  • Only creation of first generation properties (eg. label.text won't work, though they are selectable)
  • No feedback about created properties
  • You'll only know the program is done because the mouse is normal again....
  • No instructions beside these...

The Program:

post-18371-0-98387900-1306340067_thumb.j

and a template XControl:

disconnect from library.vi

Here is a screenshot:

post-2399-1167855232.png?width=400

After starting select an XControl with Select XControl, then select the controls, then select the properties. The generation is then done.

You can open the XControl by using openXControl.

Some Bugs:

Sometimes saving everything inside the xcontrol, and closing it totally will fix the xcontrol

Yes Crelf, it is not really CR ready material ;)

Ton

Share this post


Link to post
Share on other sites

I'd like to post an update to this thread. Yes, there is indeed a way to create so called "pull-right" properties for XControls.

Someone from NI informed me of a way that is not officially supported by them but none-the-less works.

All you need to do is change the localized long name of the property to include the nesting. For Example: If you have a property called My New Nested Property 1 and you want the menu to appear like Mike->My New Nested Property 1, set the Localized Long Name to Mike:My New Nested Property 1. Colon is used as the separator.

post-2-1168333561.png?width=400

post-2-1168333624.png?width=400

Further experimenting reveals you can also create line seperators by replacing the name completely with a hyphen "-". Of course, this means you lose access to the property since now it's not selectable. You would probably create dummy properties to support this.

Share this post


Link to post
Share on other sites
I'd like to post an update to this thread. Yes, there is indeed a way to create so called "pull-right" properties for XControls.

Someone from NI informed me of a way that is not officially supported by them but none-the-less works.

All you need to do is change the localized long name of the property to include the nesting. For Example: If you have a property called My New Nested Property 1 and you want the menu to appear like Mike->My New Nested Property 1, set the Localized Long Name to Mike:My New Nested Property 1. Colon is used as the separator.

Ah, I actually was looking in the right direction for this.. I tried construct like Mike|NestedProp and Mike->NestedProp, but that didn't work. Obviously I didn't try the so obvious :. :thumbdown:

Anyway, good work! :thumbup:

Share this post


Link to post
Share on other sites

QUOTE(Michael_Aivaliotis @ Dec 27 2006, 08:10 AM)

This is the same solution I have come to as well. The problem however with exposing a reference to the end user is that this breaks encapsulation rules. There is the potential of messing around with elements that you want protected.

Well, you can protect XControl's properties and methods, like you protect a library VI so VIs belonging to other libraries can't use them. Now, does that mean the end user won't see the protected properties and methods? Unfortunately, it seems not. The user will see the protected properties and methods... but will get an error if he tries to run them :rolleyes: .

Saludos,

Aitor

Share this post


Link to post
Share on other sites

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.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.