LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I make a group of few controls so I can control them as one unit?

I have a situation were I constantly switch between modes with different controls. The obvious solution is to go throug them one by one and make them un-visible. Then make the controls of the other group visible one by one.

I'm looking for more efficient way where i can define my group so I can make it visible/unvisible in one command or place it as a group in a location (top, left attributes)

Anybody know of way to do it?

Thanks
Rafi
0 Kudos
Message 1 of 3
(3,070 Views)
Rafi,

Probably the fastest way to do it is to create an array of the controls handles that represent you group.

Fisrt you initialize an array with the controls IDs like this:
int ControlsGroup[3] = {PANEL_CTRL1, PANEL_CTRL2, PANEL_CTRL3};


Once you have this array you can create a small function that hides a group in a for loop i.e:
inr HideGroup(int panelHandle, int *controls, int numberOfCtrls){
int i, err;
for (i = 0; i < nuberOfCtrls; i++){
err = SetCtrlAttribute (panelHandle, controls[i], ATTR_VISIBLE, 0);
if(err != 0)
return err;
}
return err;
}

You can also create an array of panel handles to be able to perform panel properties in groups of panels.

Let me kwno if you have any ques
tions on this.

Regards,

Juan Carlos
N.I.
Message 2 of 3
(3,070 Views)
Good advice!

Thanks Juan,
0 Kudos
Message 3 of 3
(3,070 Views)