Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to catch ESCape/Cancel as GUI control event

Clemenss
Active Contributor
0 Kudos

Hi experts,

Pressing ESCape button on keyboard triggers F12 CANCEL function for a 'normal' report status.

I would like to catch this event for a dialog control and make it raise the CLOSE event.

Is this possible?

Sorry for posting, it is really difficult to search for that - ESCAPE has too many non-related hits.

Thanks a lot.

Regards,

Clemens

5 REPLIES 5

Clemenss
Active Contributor
0 Kudos

I'd like to extend my question:

Some Controls have F1 and F4, some have ENTER event.

Is there a generalized method to register those events with any control (my own inherited controls), is it possible to register events for some or all other PF keys, for ESCAPE, for any keyboard key?

Or is it just the same as with many new SAP developments: Looks similar to something we know from somewhere out of SAP, but not providing functionality people may consider as basic.

Regards,

Clemens

0 Kudos

Sorry Clemens. Only now i understood your question.

When i pressed escape the sy-pfkey holds %_00

Clemenss
Active Contributor
0 Kudos

Hi Keshav,

I am talking about controls and the kind of events than can be used with them. This has about nothing in common with (historical) screen processing with PBO, PAI and PF-Status.

I create a control popup (CL_GUI_DIALOGBOX_CONTAINER). In the container, I create a splitter (CL_GUI_EASY_SPLITTER_CONTAINER) with a grid (CL_SALV_TABLE) on top and a toolbar(CL_GUI_TOOLBAR) below.

On the Toolbar I already put buttons for CLOSE and CLOSE_ALL. CLOSE will free all objects, call the main container's free method and close the current popup. CLOSE_ALL will do this for all popups cuurently open.

The CLOSE event of the DIALOGBOX is also registered for my closing method (set handler), this allows the popup to be closed by clicking the (windows-like) cross at the upper right.

Although this is already quite comfortable, users ask if I could react on the Escape key pressed. This leads to the question on registered keyboard keys for control toolbars. Until now, the only thing I know is to set the focus on a certain toolbar button and trigger it by pressing ENTER.

Our users are sympathetic old-fashioned keyboarders not yet used to the slow-hand-mouse gymnastics.

And I think this is really embarrassing : We can use controls technology but we can't even do the most simple things as i.e. react to a certain keystroke of the user.

Regards,

Clemens

kesavadas_thekkillath
Active Contributor
0 Kudos

I think the default ok_code for escape button is 'EXIT'. May be you can use this ok_code and try it.

Clemenss
Active Contributor
0 Kudos

It is more than ten years that SAP released the controls. But in ten years there was obviously no time wasted to enhance or even document some of them. Shame.