cancel
Showing results for 
Search instead for 
Did you mean: 

Can we catch keyboard event triggered by an inputfiled?

Former Member
0 Kudos

Hi all,

I have a question here:

When we are doing the web dynpro abap development, if I want to catch the keyboard triggered by an

input help and handle it, how can I achieve this?

e.g. I have an inputfield on the UI, if user click "F10" on the keyboard, can I catch this kind of event?

Thanks and Regards,

Aaron

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

In 7.01 and higher we can map keyboard commands to some UI elements (like buttons). However there is no event to trap keyboard input into an InputField. There is also no mechanism that allows you to hook into the Value Help request directly. You could of course use a Freely Programmed Value Help, and then you would have programtic control upon Value Help. What exactly are you trying to acomplish?

Former Member
0 Kudos

Hi Thomas,

Yes, I'm trying to acomplish an input help for an inputfield.But, the free programmed value or OVS or dictionary search help can fullfill my needs.Here is the situation:

I have a inputfield on the UI, and next to that , I have another textview, which should be changed according inputfield. e.g. the inputfield is a user name, and next to that , is the user id. but we only want the input help for user name. so when user select one row iof the search result table, I want that two fields both filled.

1. the OVS can't meet my need because I can't change the layout of the search result table, I need a table with a tree in it.

2. free programmed value help can only send back the value of the inputfield. although maybe I can get the user_id's context attribute name and by hardcoding and send back also the user id. but I don't like hardcoding.

So, I'm wondering whether I could catch the keyboard event. and handle the F4 help all by myself.

Do you have some suggestion on this?

Thanks and Regards,

Aaron

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>So, I'm wondering whether I could catch the keyboard event. and handle the F4 help all by myself.

You won't be able to do that.

>free programmed value help can only send back the value of the inputfield. although maybe I can get the user_id's context attribute name and by hardcoding and send back also the user id. but I don't like hardcoding.

I would suggest going with the freely programmed help. In the SET_VALUE_HELP_LISTENER interface method, you get access to the IF_WD_VALUE_HELP_LISTENER object. This gives you access to the source context element via f4_context_element. You can actually update any attribute you want in this context element. You wouldn't have to hard code the name of the element either. Because Freely Programmed Value Help is a component usage that you add to your main component, you can do cross component context binding. In your freely programmed value help, just create an interface context node and then this context node will be exposed for reverse binding in your main component. This way you can pass over the name of the secondary attribute and not hard code it.

Former Member
0 Kudos

Hi Thomas,

Thanks a lot for your suggestion. It has solved my problem.

I dont know why the context mapping method just can't come to my mind.

Maybe my thought was limited by the standard component.

Regards,

Aaron

daniel_rothmund
Participant
0 Kudos

Hello Thomas,

how can I use this function with 7.01. I would fire a button if the user press "enter".

Regards

Daniel

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

If you want to trigger a server event when the user presses enter in an InputField, then just use the onEnter event for that UI element.

In general 7.01 contains keyboard support; but the key combinations and UI elements where this is supported are limited. Have a look at the online Help for more details:

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/b951297a6d2d65e10000000a42189c/frameset.htm

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

There is a checkbox for activateAccessKey. How about using that.

Regards,

Lekha.

Former Member
0 Kudos

Hi Lekha,

Sorry, what you have mentioned about the activate accesskey is not I need.

I still can't catch the event of keyboard,I only can set the focus on the inputfiled.

But thanks all the same.

Regards,

Aaron