NI Home > Community > NI Discussion Forums

LabVIEW Idea Exchange

Showing results for 
Search instead for 
Do you mean 
Announcements
We've turned on a search before post feature in the LabVIEW Idea Exchange. This new feature will help cut down on the number of duplicate ideas in this space!

The NI Idea Exchange is a product feedback forum where NI R&D and users work together to submit ideas, collaborate on their development, and vote for the ones they like best. View all of the NI Idea Exchanges to post an idea or add your opinion on an existing one today!
AristosQueue

Tag an XControl as the default control/indicator for a LabVIEW class

Status: New
by Trusted Enthusiast on ‎07-01-2009 11:50 AM

LabVIEW classes are how you create new data types in LabVIEW. But part of being a new LV data type is having a front panel representation. Although users can write XControls for displaying their classes, and they can put those XControls in the palettes, whenever a user of their class chooses "Create Control" or "Create Indicator" for the LabVIEW class terminal, they get the cube display. In order to really add a new data type to LabVIEW that behaves as well as, for example, the Timestampp or the Waveform, there needs to be some way to associate a class with an XControl and say, "This particular XControl should be used as this class' default control/indicator whenever one needs to be built."  (To prevent infinite recursion and load dependency problems, whenever you did Create Control/Indicator on a member VI of the class, users would still get the cube control/indicator.)

Comments
by Trusted Enthusiast ‎07-01-2009 01:44 PM - edited ‎07-01-2009 01:44 PM

Good idea.

 

But if the XControl is a member of the class and uses even one VI of the class, doesn't this result in the XControl locking the Class locking the Xcontrol locking......?

Message Edited by Intaris on 07-01-2009 01:44 PM
by Trusted Enthusiast on ‎07-01-2009 02:43 PM
The XControl wouldn't be a member of the class. The class would have a reference to the XControl, not ownership of it.
by Trusted Enthusiast on ‎07-01-2009 02:46 PM
Aah, OK.
by Member drval on ‎08-09-2009 01:54 AM
I agree with AQ on this...great idea!
by Member gb119 on ‎08-09-2009 09:37 AM
Although solving the problem of how to allow XControls to be members of classes without locking everyting up would give much the nicest way of ensuring that the default control was available. Would also make it obvious how to make an XControl into the default control - jsut like setting the default palette, have a drop down list on a property page that lists all XControls that are members of the class that have the correct type to match the class. Somewhat like setting the default probe (another usage case where having a default control would be really handy).
by Active Participant crelf on ‎08-11-2009 03:07 PM
This is a really important attribute for the new errors class to work.
by Trusted Enthusiast on ‎08-11-2009 03:12 PM
While this should be the default it would be useful in some cases to allow the current cube to be used as the front panel control.
by Active Participant jgcode ‎08-14-2009 08:45 PM - edited ‎08-14-2009 08:48 PM

[cross posted to LAVA

 

Is this related to how the new plots are implemented in 2009?
Are the FP Objects here, associated with a default class (or in this case an array of classes)?
Or is this totally different?

 

 

New Plots.png

Message Edited by jg-code on 08-14-2009 08:48 PM
by Trusted Enthusiast on ‎08-17-2009 11:57 AM
jg-code: Totally different. The plots are using LV classes, but their FP terminals are still numeric types. This is about creating XControls whose FP Terminal type is a given LV class and then marking that class to say "when a control/indicator needs to be created for this class, use this XControl."
by Trusted Enthusiast on ‎08-17-2009 02:22 PM

I made some comments on LAVA that I want to record here also. The text in italics is from LAVA users. 

 

Daklu, on 08 August 2009 - 11:57 PM, said:

1. What happens if the class can't find the xcontrol? Is the class broken? Or, since the xcontrol is essentially a window into the class data, does the fp representation default to the cube? If that's the case, considering that the xcontrol isn't a class member, doesn't it violate the classes private data?

Mark Yedinak answered this part succintly in his post above regarding friendship and community scope. The class would not be broken if the XControl was missing. This is an editor only feature and we wouldn't want it to affect the run-time behavior of the class itself. This is merely an annotation on the class that says "when the user is creating a control/indicator of this class, if that ctrl/indicator is not on a member VI of this class nor of any subVI used by the class then the new control/indicator should be of this particular XControl instead of the cube."

 

2. Is the intended use case for the class designer to implement and deploy xcontrols with the class or to leave that to the class users?
 
The intended use case is for this to be something that the designer of the class creates. Thus if I create the Timestamp.lvclass, I could go ahead and create Timestamp.xctl which implements the calendar FP control. That way when users of my class are working, they don't see a class, they see a native LV data type with all the bells and whistles that everyone expects from a LV built-in data type.

Users of the class can already create an XControl for any given class that they want. What's missing is the hook into the LV editor for that XControl to be the default display for the class whenever LV needs to automatically create a display for the data. Currently LV uses the cube whenever it automatically creates one.

 

Paul_at_Lowell, on 11 August 2009 - 01:18 PM, said:

I'm skeptical of the above description, though. I like that on a subVI the class control and indicator are cubes or boxes. This is one advantage over using large clusters. (Something like visual encapsulation, maybe?)
Of course it would be good to have a way to display the contents of an object easily on a UI, and I can see how XControls are well-suited for this task. I just want to ensure I can still use the box control or indicator on the front panel (or the block diagram as a constant).
I'm sure we would encode some way to explicitly drop the cube, but the use case this is intended to handle is one where such an option would rarely/never be desirable. Suppose I use "Create SubVI From Selection" to create a subVI with a timestamp input. Would you want an opaque cube to show up instead of the calendar display? Almost certainly not. LV users are used to being able to see the values of their data on the FP in every subVI. Is there runtime overhead associated with this? Only if the FP is loaded. As long as the FP is not loaded into memory* then the XControl doesn't get updates and its code never runs, so it doesn't get in the way of fast subVI execution. You suggest that for hiding large clusters, this might be useful. A) For a class where you're not interested in seeing the private data, don't create any default XControl. :-) or B) You can always create a small XControl that only displays a small portion of the relevant data, or is perhaps growable/shrinkable to crunch down to small form.

* FP is not loaded as long as window not open, no open ctrl/vi refs, no use of local variables or statically bound property/invoke nodes.

 

Mark Yedinak, on 11 August 2009 - 01:56 PM, said:

This is a good question and if nothing else the user of the class should have the ability to override the X-Control with their own version.
I agree. It should be as easy as "Create new child class. Create XControl for child class. Set the XControl as the default for the child class. Change nothing else about the child class." It now has the exact same behavior as the parent but with a new display.

jgcode, on 14 August 2009 - 08:44 PM, said:

Is this related to how the new plots are implemented in 2009?
Are the FP Objects here, associated with a default class (or in this case an array of classes)?
Or is this totally different?
No, this is not related. The new plots all have LV built-in data types -- numerics, waveforms, arrays, etc. This is for creating displays for the class data types that users create. The new plots do use classes as part of their implementation, but their data type (the type of the FP terminal itself) is not a class type.

A couple more notes:

1. There probably needs to be an option for "should this XControl be used when probing this class or should the generic probe continue to be used"
2. See VI Properties dialog, Editor Options page. This page allows you to set which type of control to create on the FP when doing Create Control or Create Indicator. This feature would probably need to allow users to set different XControls for modern, classic and system displays.
Latest LabVIEW Idea Exchange Blog Posts
About LabVIEW Idea Exchange

Have a LabVIEW Idea?

  1. Browse by label or search in the LabVIEW Idea Exchange to see if your idea has previously been submitted. If your idea exists be sure to vote for the idea by giving it kudos to indicate your approval!
  2. If your idea has not been submitted click Post New Idea to submit a product idea to the LabVIEW Idea Exchange. Be sure to submit a separate post for each idea.
  3. Watch as the community gives your idea kudos and adds their input.
  4. As NI R&D considers the idea, they will change the idea status.
  5. Give kudos to other ideas that you would like to see in a future version of LabVIEW!
Idea Statuses
Top Kudoed Authors
User Kudos Count
85
46
43
39
33