LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

List Box Control

By default we need to excite 15 tests, all displayed in a list box, on the press of the start button.

If all test pass a green banner is displayed but on the first fail a red banner is displayed.

How is this best done?

On pressing a debug button, a password is requested.

Now, on getting the correct password, the same list is made available and

individual or a number of tests can selected.

The selected test(s) will run on pressing the start button.

How is this best done?

In both cases if a test failed the line will be turned red and if passed

the line will go red.

How is this best done?

Is there sample code that might fit my requirements?

Thanks for the help

Simon

0 Kudos
Message 1 of 3
(3,895 Views)

This is only a partial response to your list of questions. Smiley Wink

1. Password: CVI comes with a built-in password control. You can generate a password input field by right-clicking on a panel and selecting Custom controls >> Toolslib controls >> Password control in the context menu. Right clicking on the created control, select Generate custom control code and CVI will add the necessary files on your application. Next with PasswordCtrl_GetAttribute you can retrieve the password entered as a string and decide if it's valid or not

2. Selecting individual tests: if your list is in check mode an additional column is displayed on the control into which individual items can be selected / deselected. If you enable draggable marks the user can drag the mouse to select groups of items. All these options are available in the UIR editor (edit list box panel, List box options button) but can be set programmatically with some SetCtrlAttribute statements if required.

3. Evidencing individual test result: in this case the list box is maybe not the best control for this, since the evidence can conflict with normal highlight bar color. Moreover, there is not an easy way to paint all the line in some colour. It is to be noted nevertheless that evidencing a test result is done in "Test execution mode" while the highlighting bar should be available only in "Presetting mode". The highlighting bar cna be hidden by using

SetCtrlAttribute (panel, control, ATTR_HILIGHT_CURRENT_ITEM, 0);

In my opinion it's better to add a bar of leds or color numerict to the side of the list box to signal test results, but this opinion is heavily based on personal esthetic considerations so that it's the most criticable of all. Smiley Tongue

Anyway, here some suggestions.

To paint a text (either foreground or background colour) you can use escape character codes while (programmatically) filling the listbox. For a reference, take a look to the online help for "Item label" field in InsertListItem function. You can set the colour of the text and / or the background, but keep in mind the only the background of text actually written will be coloured: if you want to enlarge the painted bacroung you must add extra spaces to the string.

 

Message Edited by Roberto Bozzolo on 12-14-2005 09:04 AM



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 2 of 3
(3,876 Views)

Hi,

 

Thanks for the replay.

 

Password. Good to know this, it will be useful as I did not know it could be called from the Panel.

 

I have been trying to use a child panel. So I will work on this.

 

After you comment “not an easy way” to do this with a List box I have changed to Check Boxes, which I can easily control (with my limited CVI experience) the test colour.

 

The same is true of the tick with in the box, I can control these easily from the program.

 

I just thought it would be good to use the List box as I had a “list” of test to do.

 

Unless I have missed some major advantage of using the list box with 15 items over 15 check boxes it might be easer to go with the check boxes!

 

Thanks for the help

            Simon
0 Kudos
Message 3 of 3
(3,860 Views)