Add a "user event" chapter to the first steps document
This commit is contained in:
parent
7749d28b92
commit
c64b17ac49
|
@ -11,6 +11,9 @@ Table of Contents
|
||||||
- [Memory Management](#memory-management)
|
- [Memory Management](#memory-management)
|
||||||
- [Event Processing](#event-processing)
|
- [Event Processing](#event-processing)
|
||||||
- [Event handler reimplementation](#event-handler-reimplementation)
|
- [Event handler reimplementation](#event-handler-reimplementation)
|
||||||
|
- [Event types](#available-event-types)
|
||||||
|
- [Timer event](#using-a-timer-event)
|
||||||
|
- [User event](#using-a-user-event)
|
||||||
- [Signals and Callbacks](#signals-and-callbacks)
|
- [Signals and Callbacks](#signals-and-callbacks)
|
||||||
- [Default signals](#the-final-cut-widgets-emit-the-following-default-signals)
|
- [Default signals](#the-final-cut-widgets-emit-the-following-default-signals)
|
||||||
- [Callback function](#example-of-a-callback-function)
|
- [Callback function](#example-of-a-callback-function)
|
||||||
|
@ -280,7 +283,7 @@ types to specific event handlers such as `FMouseEvent()`, `FKeyEvent()` or
|
||||||
types and send them to other objects and widgets.
|
types and send them to other objects and widgets.
|
||||||
|
|
||||||
|
|
||||||
**The FINAL CUT event types:**
|
### Available event types ###
|
||||||
```cpp
|
```cpp
|
||||||
enum events
|
enum events
|
||||||
{
|
{
|
||||||
|
@ -312,7 +315,7 @@ enum events
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
**Using a timer event**
|
### Using a timer event ###
|
||||||
|
|
||||||
The following example starts a periodic timer that triggers an `FTimerEvent()`
|
The following example starts a periodic timer that triggers an `FTimerEvent()`
|
||||||
every 100 ms. The virtual method `onTimer()` is then called each time in the
|
every 100 ms. The virtual method `onTimer()` is then called each time in the
|
||||||
|
@ -381,20 +384,21 @@ g++ -O2 -lfinal -std=c++11 timer.cpp -o timer
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
**Using a user event**
|
### Using a user event ###
|
||||||
|
|
||||||
You can use the FUserEvent() to create a individual event and send it to a
|
You can use the `FUserEvent()` to create a individual event and send it to a
|
||||||
specific object. If you want to create more than one user event, you can
|
specific object. If you want to create more than one user event, you can
|
||||||
specify an identification number (0 in the example below) to identify the
|
specify an identification number (0 in the example below) to identify the
|
||||||
different events. This number can get later with getUserId().
|
different events. This number can get later with `getUserId()`.
|
||||||
|
|
||||||
User events should be generated in the main event loop. For this purpose, the
|
User events should be generated in the main event loop. For this purpose,
|
||||||
class FApplication provides the virtual method processExternalUserEvent().
|
the class `FApplication` provides the virtual method
|
||||||
This method can be overwritten in a derived class and filled with user code.
|
`processExternalUserEvent()`. This method can be overwritten in a derived
|
||||||
|
class and filled with user code.
|
||||||
|
|
||||||
The following example reads the average system load and creates a user event
|
The following example reads the average system load and creates a user event
|
||||||
when a value changes. This event sends the current values to an FLabel widget
|
when a value changes. This event sends the current values to an `FLabel`
|
||||||
and displays them in the terminal.
|
widget and displays them in the terminal.
|
||||||
|
|
||||||
|
|
||||||
**File:** *user-event.cpp*
|
**File:** *user-event.cpp*
|
||||||
|
|
Loading…
Reference in New Issue