LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid values in ring controls

I'm using version 8.1.1 of LabWindows and I was wondering if there is any way of putting a value that is currently not defined in the item/value pair combinations for the control using the SetCtrlVal function? I don't want to have to validate the non-defined value against the item/value pair combinations and then insert the new value through my program. IE - the ring control should realize that the value does not match any of its defined item/value pair combinations and automatically perform some operation when SetCtrlVal() is called. It would be acceptable for the control to have the red-box around it similiar to when a numeric control is out of range when this happens.

The problem I'm having is that a get a block of data from an external device and I want to display the values in a set of ring controls. In some cases the data from the external device has not been initialized and therefore does not match any of the valid values (enties in the ring control) that it should. Thus the UIR containing the ring controls looks like it either didn't update or that the value is set to one of the correct values for that parameter, which is missleading to the user.

Thanks
0 Kudos
Message 1 of 2
(3,093 Views)

From CVI Help:

Ring Controls Overview

Use ring controls to select from a group of items.

If you want to use the controls for display only, I suggest that you use regular Numeric or String controls instead.

If you really need to use rings, e.g. to keep a record of all values returned by your device, you could try this approach:

  • Call
    status = SetCtrlVal();
    to attempt to set the control
  • Check the return value
  • if (status == -59)  // "The value passed is not in the list control"
    • Insert a new Label/Value pair into the control using InsertListItem()
      Note: Extra logic is required if you want to keep the values sorted, see GetNumListItems(), GetValueFromIndex()
    • Call SetCtrlVal() again to update the control

Good luck,
Colin.

 

0 Kudos
Message 2 of 2
(3,074 Views)