Monday, March 19th 2018, 4:02am UTC+1

You are not logged in.

  • Login
  • Register

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: 512


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: