LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Control Array example clarification...

Solved!
Go to solution

Hello,

 

This might be an elementary question, but I just stumpled upon the 'ledctrlarray' example in LabWindows/CVI.

 

My issue:

 

I dont' see the linkage between the 'CTRLARRAY' and all the LED controls on the panel.

The panel is populated with 29 LEDs, a numeric knob, a color control, and a timer. When you call 'GetCtrlArrayFromResourceID' you provide the panel handle and CTRLARRAY and get the control array handle. Then you call 'GetNumCtrlArrayItems' with ythe control array handle and get the number of LEDs on the panel.

 

How are just the LEDs linked to the CTRLARRAY resource id?

I guesss I am missing how the CTRLARRAY resource id gets into the ledctrlarray.h file to begin with.

 

Thank you in advance for your input.

John O'C
Staff Test Systems Engineer
Woodward, Inc.
Skokie, Illinois, USA

"Life is not a journey to the grave with the intention of arriving safely
in a pretty and well preserved body, but rather to skid in broadside,
thoroughly used up, totally worn out, and loudly proclaiming...
Wow...What a Ride!"
0 Kudos
Message 1 of 6
(3,724 Views)

Sorry just figured it out.

 

Highlight all the controls that you want in the control array. Right-click on the one of the highlighted controls got to control array and select new. Then name your array. 

John O'C
Staff Test Systems Engineer
Woodward, Inc.
Skokie, Illinois, USA

"Life is not a journey to the grave with the intention of arriving safely
in a pretty and well preserved body, but rather to skid in broadside,
thoroughly used up, totally worn out, and loudly proclaiming...
Wow...What a Ride!"
0 Kudos
Message 2 of 6
(3,716 Views)
Solution
Accepted by topic author johnoc

Sorry I just figured it out.

 

Highlight all the controls that you want in the control array. Right-click on the one of the highlighted controls go to control array and select new. Then you can name your array. 

John O'C
Staff Test Systems Engineer
Woodward, Inc.
Skokie, Illinois, USA

"Life is not a journey to the grave with the intention of arriving safely
in a pretty and well preserved body, but rather to skid in broadside,
thoroughly used up, totally worn out, and loudly proclaiming...
Wow...What a Ride!"
0 Kudos
Message 3 of 6
(3,715 Views)

You can see the controll array listed in the user interface browser, to the right side of the UIR editor: after all controls are listed, a Control Arrays item is found that can be expanded to see which controls are included in the array.

 

Screenshot 2017-07-11 16.34.26.png

 

This is an important issue, as the order controls are listed in the array defines which control is addressed with GetCtrlArrayItem (ctrlarray, index); Controls can be arranged in the array by simple drag and drop in the Interface browser

Controls can be added to a control array by right clicking on them and selecting Add to Control Array in the context menu.



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?
Message 4 of 6
(3,714 Views)

OK I see you already got the answer. But keep my suggestion anyway since the order controls are listed in the array cannot be defined correctly when interactively adding controls: in my experience almost always I need to rearrange them to obtain the desired behaviour.



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 6
(3,708 Views)

Thank you Roberto. I figured it out just before you replied.

John O'C
Staff Test Systems Engineer
Woodward, Inc.
Skokie, Illinois, USA

"Life is not a journey to the grave with the intention of arriving safely
in a pretty and well preserved body, but rather to skid in broadside,
thoroughly used up, totally worn out, and loudly proclaiming...
Wow...What a Ride!"
0 Kudos
Message 6 of 6
(3,706 Views)