Kbase 21307: How to correctly use a VALUE-CHANGED trigger in a SmartDataViewer (SDV)
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2008 |
|
Status: Verified
GOAL:
How to correctly use a VALUE-CHANGED trigger in a SmartDataViewer (SDV)
FACT(s) (Environment):
Progress 9.x
FIX:
When using SmartDataViewers creating a VALUE-CHANGED trigger for a field causes the TableIO source (toolbar, panel) which is linked to the SmartDataViewer to lose its sensitivity and not enable the Save button as would be expected.
The way that this functionality is maintained is linked to the VALUE-CHANGED event for everything in the frame of the SmartDataViewer. Therefore, in viewer.i a VALUE-CHANGED trigger is defined for the frame.
In Progress, the last trigger defined for a widget at compile-time is the one that gets used. Thus, if you create a VALUE-CHANGED trigger in the SmartDataViewer itself, this overrides the default trigger defined in viewer.i.
The trigger that's defined in viewer.i simply does a RUN ValueChanged IN THIS-PROCEDURE. This enables the user to capture the behavior of the default ADM2 without actually having to maintain ADM2 code.
In early versions of ADM2, the code of valueChanged was located in the event 'U10' of THIS-PROCEDURE. Later, the code was moved to the valueChanged internal procedure, however the following piece of code was implemented to achieve backward compatibility:
ON 'U10':U OF THIS-PROCEDURE RUN valueChanged IN THIS-PROCEDURE.
Therefore, in order to maintain custom logic for the VALUE-CHANGED event of a field in a SmartDataViewer as well as the default behavior, the trigger code should look something like this:
ON VALUE-CHANGED OF RowObject.<fieldname> IN FRAME {&FRAME-NAME}
DO:
RUN ValueChanged IN THIS-PROCEDURE.
/*or APPLY 'U10':U TO THIS-PROCEDURE.
=> was kept for backward compatibility*/
<Your code here...>
END.