Consultor Eletrônico



Kbase P18202: How to deactivate the PSTimer on the start of a dialog box widget and reactivate it on the close of
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/30/2004
Status: Unverified

GOAL:

How to deactivate the PSTimer on the start of a dialog box widget and reactivate it on the close of that widget?

FACT(s) (Environment):

Windows

FIX:

1. From the UIB, create a new window widget.
2. Drop a button widget on the window.
3. Drop the PSTimer OCX control on the window. Set its interval to 100.
4. Drop a FILL-IN widget with INTEGER data type on the window.
5. Define a CHOOSE trigger for the button as:

RUN myDialogBox.w(INPUT chCtrlFrame).

6. Define the OCX.Tick trigger as:

FILL-IN-1 = FILL-IN-1 + 1.
FILL-IN-1:SCREEN-VALUE IN FRAME {&FRAME-NAME} = STRING (FILL-IN-1).

7. Save the window as myWindow.w.
8. From the UIB, create a new dialog widget.
9. In the Definition section of the dialog box define the input parameter:

DEFINE INPUT PARAMETER chCtrlFrame AS COMPONENT-HANDLE NO-UNDO.

10. To deactivate the PSTimer on the start of the dialog box, insert the following statement after the ? RUN enable_UI.? In the Main Block section of the dialog box.

ASSIGN
chCtrlFrame:PSTimer:ENABLED = FALSE.
11. To reactivate the PSTimer when the dialog box closes, insert the following statement before the ?APPLY "END-ERROR":U TO SELF.? In the WINDOW-CLOSE trigger section of the dialog box as well as in the dialog Btn_OK Btn_Cancel CHOOSE triggers.

ASSIGN
chCtrlFrame:PSTimer:ENABLED = TRUE.
12. Save the dialog box as myDialogBox.w.
13. Run myWindow.w.
14. Notice that the timer stops when you activate the dialog box and it is reactivated if you close the dialog.