Consultor Eletrônico



Kbase P158414: Changes to check box controls are not saved in binding source or database
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   15/06/2010
Status: Unverified

SYMPTOM(s):

Changes to check box controls are not saved in binding source or database

Changes to UltraCheckEditor are not saved in binding source or database.

Changes to Microsoft CheckBox control are not saved in binding source or database.

FACT(s) (Environment):

Changes are saved using code similar to the following:

pControl:Controls[iCtr]:DataBindings["Value"]:WriteValue() NO-ERROR. /* write value from control to binding source */
Windows
OpenEdge 10.2x

CAUSE:

Neither UltraCheckEditor nor CheckBox controls have a Value property. The code that attempted to use this value raised an error, but the message was suppressed with NO-ERROR and ERROR-STATUS was not examined later in the code. Therefore, the code failed silently.

FIX:

Both CheckBox and UltraCheckEditor have a CheckState property that can have a value of True, False, or Indeterminate. UltraCheckEditor also has a CheckValue property that is a nullable System.Boolean value. Reference one of these to determine whether the control is checked.
Code like the line above, which does not know the type of the control until run time, can use the GetType method of the Progress.Util.TypeHelper class to determine which control class is being referenced, and therefore which properties it will have. For example:
IF pControl:Controls[iCtr]:GetType():Equals(Progress.Util.TypeHelper:GetType("UltraCheckedEditor")) THEN
pControl:Controls[iCtr]:DataBindings["CheckedValue"]:WriteValue() NO-ERROR.
ELSE
... /* code for other possible control types */
/* Notify user if there were unexpected errors */
IF ERROR-STATUS:NUM-MESSAGES > 0 THEN
DO:
iNumMessages = ERROR-STATUS:NUM-MESSAGES.
MESSAGE iNumMessages 'unexpected error(s)' VIEW-AS ALERT-BOX.
DO iMessageIndex = 1 TO iNumMessages:
MESSAGE ERROR-STATUS:GET-MESSAGE (iMessageIndex) VIEW-AS ALERT-BOX.
END. /* iNumMessages */
END. /* ERROR-STATUS:NUM-MESSAGES > 0 */