68 views
in GUI Development by
Hello Ask Embedded Wizard forum members!

I'm working on a project where I'm using an encoder to create a pointer, and I want to use the encoder to navigate to and interact with pressable areas on the screen by rotating it left and right. In this project, we are stacking all the components on top of each other on the application.

How can I locate the active (visible and enabled) components on the screen using the encoder? Once I've found these components, how can I retrieve their coordinates and add visual effects to indicate that they are being selected?

 

Best Regards

1 Answer

0 votes
by

Hello,

the simplest approach would be to consider the encoder as a keyboard inout device. Rotating it left/right could thus generate corresponding Left or Right keyboard events. Pressing the encoder (?) or pressing any other dedicated button could generate an Ok, Escape, etc. key event.

To feed the events in the running Embedded Wizard application you could modify the function EwGetKeyCommand() implemented usually in the module ewmain.c belonging to our Build Environments. Your modification should check the information retrieved from the encoder and return the corresponding key code. See also the chapter Main loop and especially the section Step 3: Processing Key Events.

Once the key event feeding is implemented, you handle the events in the GUI application conveniently using the Key Press Handler. This mechanism takes care of dispatching the events to the GUI components by taking in account the actual selection, etc. See the mentioned chapter for more details.

I hope this approach helps you further.

Best regards

Paul Banach

Embedded Wizard Website | Privacy Policy | Imprint

...