Consultor Eletrônico



Kbase 19847: 4GL. How to Disable CTRL-C on GUI Applications (Break Event)
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   24/09/2008
Status: Verified

GOAL:

How to disable the key combination CTRL-C in applications (Break-Event)

GOAL:

Program is a persistent procedure

GOAL:

CTRL-C Event

FIX:

Every Simple or Smart Window has an END-ERROR or ENDKEY trigger, consisting of the following code:

ON END-ERROR OR ENDKEY OF {&WINDOW-NAME} ANYWHERE DO:
/* This case occurs when the user presses the "Esc" key.
In a persistently run window, just ignore this. If we did not, the application would exit. */


IF THIS-PROCEDURE:PERSISTENT THEN RETURN NO-APPLY.
END.


This code applies just for persistent procedures, and the CTRL-BREAK is not disabled here.

In order to to disable CTRL-C in a GUI application even if it is not persitent, modify the trigger as follows:

ON END-ERROR OR ENDKEY, CTRL-C OF {&WINDOW-NAME} ANYWHERE DO:
/* This case occurs when the user presses the "Esc","CTRL-C" Key.
Return no-apply will disable the keys mentioned above.*/

RETURN NO-APPLY.

END.

As you can see now there is no condition verifying if the procedure is persistent or not, and the trigger list has another entry (CTRL-C).
The main window of the application won't be closed until a normal exit is done.

The CTRL-BREAK event is an OS-LEVEL event and cannot be controlled directly within Progress.