LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding Controls on a Panel

I am writing several configuration screens for various tests and I would
like to find/create a function that would find all the controls on a
page and one by one save them, this is easy enough, except I have no way
of knowing what type of control I have.

I plan on starting with the panel 1 and setting the active control ++
until I receive an error. As the UIR always maintains the controls from
1 up in a contiguos fashon. My problem is I need a function like
GetControlType so I know if I am dealing with a check box or a table.

Any Ideas??
0 Kudos
Message 1 of 5
(4,338 Views)
if you have a diferent label for each control and a table on your source code
that contain all labels with they respective type, than you can discover
the type using getControlAttribute - control Label text and so verifying
the table.

John Stuart wrote:
>I am writing several configuration screens for various tests and I would>like
to find/create a function that would find all the controls on a>page and
one by one save them, this is easy enough, except I have no way>of knowing
what type of control I have.>>I plan on starting with the panel 1 and setting
the active control ++>until I receive an error. As the UIR always maintains
the controls from>1 up in a contiguos fashon. My problem is I need a function
like>GetControlType so I know if I am deali
ng with a check box or a table.>>Any
Ideas??>>>
0 Kudos
Message 2 of 5
(4,338 Views)
According to CVI documentation the right way should be this one:

GetPanelAttribute (PANEL, ATTR_PANEL_FIRST_CTRL, &ctl);
// Find first control in the panel
while (TRUE) {
// Find control's style
GetCtrlAttribute (PANEL, ctl, ATTR_CTRL_STYLE, &style);
switch (style) {
case CTRL_NUMERIC:
// Your code to retrieve and save control's value
break;
// Other styles to control here
//
default:
// All styles not interesting: those ctls are simply skipped
break;
}
// Look for next control in the panel
GetCtrlAttribute (PANEL, ctl, ATTR_NEXT_CTRL, &ctl);
if (!ctl) break; // End of panel controls
}

Regards
Roberto


"John Stuart" ha scritto nel messaggio
news:3A65DB69.7B8348B0@cisco.com...
> I am writing several configuration screens
for various tests and I would
> like to find/create a function that would find all the controls on a
> page and one by one save them, this is easy enough, except I have no way
> of knowing what type of control I have.
>
> I plan on starting with the panel 1 and setting the active control ++
> until I receive an error. As the UIR always maintains the controls from
> 1 up in a contiguos fashon. My problem is I need a function like
> GetControlType so I know if I am dealing with a check box or a table.
>
> Any Ideas??
>
>
>
0 Kudos
Message 3 of 5
(4,338 Views)
Thanks,

This is how I implemented it. Could you please tell me the location of this
information in the CVI Documentation. I found it by accident in the Help
file. I would prefer to find information like this in a printed manual so I
can read it offline.

STU

Roberto wrote:

> According to CVI documentation the right way should be this one:
>
> GetPanelAttribute (PANEL, ATTR_PANEL_FIRST_CTRL, &ctl);
> // Find first control in the panel
> while (TRUE) {
> // Find control's style
> GetCtrlAttribute (PANEL, ctl, ATTR_CTRL_STYLE, &style);
> switch (style) {
> case CTRL_NUMERIC:
> // Your code to retrieve and save control's value
> break;
> // Other styles to control here
> //
> default:
> // All styles not interesting: those ctls are simply
skipped
> break;
> }
> // Look for next control in the panel
> GetCtrlAttribute (PANEL, ctl, ATTR_NEXT_CTRL, &ctl);
> if (!ctl) break; // End of panel controls
> }
>
> Regards
> Roberto
>
> "John Stuart" ha scritto nel messaggio
> news:3A65DB69.7B8348B0@cisco.com...
> > I am writing several configuration screens for various tests and I would
> > like to find/create a function that would find all the controls on a
> > page and one by one save them, this is easy enough, except I have no way
> > of knowing what type of control I have.
> >
> > I plan on starting with the panel 1 and setting the active control ++
> > until I receive an error. As the UIR always maintains the controls from
> > 1 up in a contiguos fashon. My problem is I need a function like
> > GetControlType so I know if I am dealing with a check box or a table.
> >
> > Any Ideas??
> >
> >
> >
0 Kudos
Message 4 of 5
(4,338 Views)
Sorry, I too found these informations in the help files.
You can find some detail in the User Interface Reference Manual, but only a
little regarding the matter we are discussing about. I spent a lot of time
in temptative coding due to lack in the documentation, but found NI support
useful and ready to answer to my questions.
Roberto
0 Kudos
Message 5 of 5
(4,338 Views)