Wednesday, May 23rd 2018, 5:37am UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Mr. Spock


Date of registration: May 19th 2009

Posts: 22


Friday, February 2nd 2018, 11:54am

Intercepting keys in callback()


In my project there is no touchscreen but an external keyboard. Want to intercept key ESCAPE (0x1b) when a DROPDOWN widget has focus. Apparently function callback() never is triggered when key ESCAPE is pressed. How to sove this ?


SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 584


Monday, February 5th 2018, 4:22pm


This is kind of tricky, because there are two things to consider. First is, after clicking the DROPDOWN widget the listbox will get the focus and therefore the DROPDWON won't receive any key messages once it is expanded. The other one is that the LISTBOX is created dynamically and it is not easy to set callback for the LISTBOX of the DROPDOWN widget.

Attached is an example on how you could do it anyway. I have set a callback for the DROPDOWN widget. It only checks if a LISTBOX is present and if it is it sets a callback to the LISTBOX.

The callback of the LISTBOX reacts on key messages and collapse the DROPDOWN if the escape key has been pressed.

SEGGER - Schoenen has attached the following file: