Kbase 16055: Combo-box does not set ERROR-STATUS:ERROR -- Workaround
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
Combo-box does not set ERROR-STATUS:ERROR -- Workaround
The combo-box widget does not set ERROR-STATUS:ERROR to "true" if
you attempt to set its screen-value to a value that is not included
in the list of its valid items.
For example, if your combo-box has RED, GREEN, and BLUE as possible
settings, ERROR-STATUS:ERROR will not be true if you programmatically
set the screen-value to YELLOW:
combo-box-1:SCREEN-VALUE = "Yellow".
The workaround is to set ERROR-STATUS:ERROR yourself, using 4gl code
as follows:
DEF VAR newvalue AS CHAR.
IF LOOKUP(newvalue, combo-box-1:LIST-ITEMS IN FRAME f) <> 0
THEN DO:
ASSIGN combo-box-1:SCREEN-VALUE = newvalue.
ERROR-STATUS:ERROR = false.
END.
ELSE ERROR-STATUS:ERROR = true.
For further ease of implementation, it is possible to turn this
algorithm into an internal procedure which can be called when you
are ready to set the combo-box screen-value:
RUN setcombo (INPUT newvalue).
/* Procedure setcombo */
DEF INPUT PARAMETER x AS CHAR.
IF LOOKUP(x, combo-box-1:LIST-ITEMS IN FRAME {&FRAME-NAME}) <> 0
THEN DO:
ASSIGN combo-box-1:SCREEN-VALUE = newvalue.
ERROR-STATUS:ERROR = false.
END.
ELSE ERROR-STATUS:ERROR = true.
Implementing this as an external procedure would be more difficult,
since it would be require passing an argument giving the frame-name
where the combo-box resides.
Progress Software Technical Support Note # 16055