GEVENT FAQ

From uGFX Wiki
Jump to: navigation, search

The following is a small summarizing of frequently asked question around the GEVENT module.


What does the GEVENT module do?

GEVENT is a message passing communication mechanism. It is primarily used for connecting input devices (real and virtual) to things that want to know about that input.

What is a source?

A source is something that can provide input to your application. Example sources might include a touchscreen, some hardware toggle buttons, an analoge potentiometer, a keyboard, a GPS device etc. It can also include virtual input devices such as a button drawn on your touchscreen.

What is a listener?

A listener is something that wants to listen for inputs from sources. For example, a button on the screen wants to know about touchscreen input, your application might want to know when a hardware toggle button changes state.

What is an event?

An event is a piece of information being passed from a source to a listener. For example, a key press on a keyboard will generate a KEYPRESS event describing which key was pressed.

Would a source want to send events to more than one listener?

Yes. Sometimes there are more than one listener that wants to know information from a source. For example, multiple buttons on the screen might want to know about events from the touchscreen. The application itself might also want to know about finger movements so that it can draw a line on the screen under the touch.

Would a listener want to listen to more than one source?

Yes. A listener might want to know about more than one source. For example, a button on the screen might be triggered from a hardware toggle button and from a press on the touchscreen. Your application might want to know about multiple input sources such as keyboards, mouse, buttons, analogue devices.

Can something be both a source and a listener?

Yes. An example is a button or slider drawn on your LCD screen. It is a listener for touchscreen events (and possibly hardware buttons), but it is also a source for your application which wants to know when the button is pressed or the slider moved.