Release 10.1A: OpenEdge Development:
Progress Dynamics Advanced Development

> ## Writing the supporting procedures for the UI event

> Now you must edit the customersuper.p procedure to add the internal procedure to be executed when the UI event occurs so that `CreditLimitLeave` checks first to see if the CreditLimit field has been modified. First create a support function, called `widgetModified`, to take care of that check. This function checks the Progress 4GL `MODIFIED` attribute for the field and returns true or false accordingly, as shown:

>     FUNCTION widgetModified RETURNS LOGICAL
>       ( pcField AS CHARACTER ) :
>     /*-------------------------------------------------------------------------
>       Purpose:  Returns TRUE if the widget value has been changed.
>        Params:  pcField AS CHARACTER
>     -------------------------------------------------------------------------*/
>     DEFINE VARIABLE hField AS HANDLE     NO-UNDO.
>       hField = widgetHandle(pcField).
>       IF VALID-HANDLE(hField) AND CAN-SET (hField, 'MODIFIED') AND
>         hField:MODIFIED THEN
>           RETURN TRUE.
>       ELSE RETURN FALSE.
>     END FUNCTION.

> The next step is to code the `CreditLimitLeave` procedure itself. In this example, the same condition is duplicated from the `rowDisplay` procedure. Obviously, in a properly completed example this code should be pulled out into a separate internal procedure called from both places, as shown:

>     PROCEDURE CreditLimitLeave:
>     /*-------------------------------------------------------------------------
>       Purpose:     Check the CreditLimit against the balance on LEAVE.
>       Parameters:  <none>
>     -------------------------------------------------------------------------*/
>     IF widgetModified('CreditLimit') THEN
>       IF DECIMAL(widgetValue('CreditLimit')) -
>          DECIMAL(widgetValue('Balance')) < 5000
>            THEN highlightWidget('Balance').
>       ELSE unhighlightWidget('Balance').
>     END PROCEDURE.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095