198 views
in GUI Development by
Hi.

I have a menu where I created a button template as a component.

After hovering over a component with the mouse (without clicking),I would like to move it up a little.

Is there any function that would use the current position of the cursor?

If not, what is the most sensible way to get this effect.

1 Answer

0 votes
by

Hello Kyo,

there is no support for hover events in Embedded Wizard. Our focus is on touch screens, which don't provide however events. If it is inevitable in your application case to handle hover events, you can implement the event dispatching functionality by yourself. Following are few hints you would need to know when implementing such mechanism:

1. Internally, all user inputs are distributed and delivered to the views/components as objects of a class descending from Core::Event. You would need thus to derive your own class e.g. Application::HoverEvent and implement it to store the position information, status, etc. of the hover event.

2. In order to be able to receive and handle your own event, you will need to override the HandleEvent() method within the view or GUI component where you want the event to be handled.

3. To dispatch the event use the method BroadcastEventAtPosition(). When you invoke the method in context of the Application object (the root object), the event can be dispatched to any view/component existing actually in your application.

4. To feed the hover event into the GUI application you will also need to modify the glue code (usually found in the build environment). If the target is Win32, the affected functionality is implemented in the module ewapp.c. In your implementation you would need to receive the mouse move event and feed it into the Application object. Then the Application object can envolve the event into your own event object (see item 1) and broadcast it to all affected views (see item 3).

So far the technical backgrounds. If you decide to follow this approach I would also recommend to analyse the Mosaic implementation of the already existing events (e.g. Core::DragEvent), the handling of the events (e.g. Core::SimpleTouchHandler) and how the events are fed into the GUI application (e.g. the method DriveMultiTouchMovement()).

Best regards

Paul Banach

Embedded Wizard Website | Privacy Policy | Imprint

...