Saturday, February 24th 2018, 2:57am UTC+1

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

Beginner

Date of registration: May 19th 2009

Posts: 17

1

Friday, February 2nd 2018, 11:54am

Intercepting keys in callback()

Hi

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 ?

Regards

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 496

2

Monday, February 5th 2018, 4:22pm

Hi,

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.

Regards
Sven
SEGGER - Schoenen has attached the following file: