LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

grouping controls in the UIR editor

This may have been broached before, but ....

 

It seems to me that it would be a nice feature to be able to group controls in the UIR editor - as it is now, you can draw a select box around a set of controls (or select them with shift-leftclick) and cause them to all be highlighted - so the editor "knows" how to keep track of a group of controls for editing purposes.

 

An extension to this would be for the UIR editor to allow you to generate a named list of the controls you've grouped together, and stuff this into the header file associated with the panel.   Getting a data type in the .h file to hold the list might be messy, but it surely would be useful.  Maybe a macro would do the trick.

 

For example, I have a symetric panel with two large groups of controls, which I would like to dim/undim as a group.  While there's a toolbox function to set attribute on a list of controls, you have to manually create the control ID list and include these in the function.  This is a hassle in that I wind up manually hacking a function call with a jillion control ID's in it.

 

Wouldn't it be much easier to be able to simply specify a control group name and have the list of control IDs automagically be included in the function call? 

 

Menchar

 

 

Message Edited by menchar on 06-10-2010 04:17 PM
0 Kudos
Message 1 of 8
(4,149 Views)

Well, this could be an useful feature to add to the UIR editor.

It happens to me too that I need to manually create a list of all or some controls in a panel: having the editor complete this task for me could simplify my job and reduce the possibility of errors / omissions



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 8
(4,137 Views)

menchar wrote:

 

For example, I have a symetric panel with two large groups of controls, which I would like to dim/undim as a group. 


Can you put these groups of controls on frameless child panels embedded in your main one, and then just dim/undim the child panel? I sometimes use this approach to regulate which controls are saved/restored with SavePanel/RestorePanel operations - I don't always want to save everything.

 

JR

0 Kudos
Message 3 of 8
(4,126 Views)

JR -

 

Good idea, though I kindof don't like the idea of a child panel anchored somehow onto the main panel.

 

Another approach to this would be some kind of collecting decoration or control.

 

VB used to have control arrays, VB.net dropped them I think.  You could group controls into an array and do common operations on the included controls in a simple way.

 

I've resorted to creating Lists in CVI and then building various lists of control Id's, then looping through the list to dim / undim for example.  But what a pain.

 

Menchar

Message Edited by menchar on 06-11-2010 10:41 AM
0 Kudos
Message 4 of 8
(4,108 Views)

JR

 

I have used the approach you suggest in some application of mine and indeet it works as you say. It also helps logically grouping controls in top level applications that monitors several similar pieces of equipment: one-panel-per-equipment approach dramatically improves the look and feel of the application thus making operator's life easier.

 

Nevertheless, it introduces some sort of gap in tabbing order: the user must switch someway to the child panel to be able to operate on controls located on it: while this is easy with the mouse, it is difficult to use on machines located on a production line, where operators are not expected to have it or could have problems if operating with gloves or so. In these cases appropriately setting the tab order helps the user to interact with the program with the keyboard only, provided all relevant controls are on a single panel.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 8
(4,091 Views)

Roberto -

 

You're right about how you're unable to tab thru controls if you use child panels to group your controls. In the past, I've gotten around this by programmatically setting the child panel as the active panel (and give the focus to desired 1st control of the child panel) in the callback in response to a <tab> character. You also need to go from the child panel to the parent panel at the last control on the child panel, and look out for <shift+tab> to tab thru the controls backwards.

 

- jared

0 Kudos
Message 6 of 8
(4,052 Views)

In CVI 2010, you can now create a control array in the UI editor to group controls together. Then, at runtime, you can perform operations on all the controls with new functions such as SetCtrlArrayAttribute, SetCtrlArrayVal, and MoveCtrlArray. For example, call SetCtrlArrayAttribute(ctrlArrayHandle, ATTR_DIMMED, 1) to dim all the controls in the control array.

 

You can also easily iterate thru the control array with GetCtrlArrayItem.

 

Hope this is what you were looking for.

 

- jared

Message 7 of 8
(3,738 Views)

Yup, this does the trick, good addition.

 

I have seen some horrors with people trying to implement control groupings - trying to do algebra on control ID's for example.  It works until someone adds or deletes a control and the control ID's change ...

0 Kudos
Message 8 of 8
(3,725 Views)