Automatic Event Handling

From VirtualFabWiki
Jump to: navigation, search

For each control you placed on your screens you can directly write C code you want to execute when certain event happens on that control.

For example, the Button control can generate, in the GOL standards, the following events:

  • BTN_MSG_PRESSED fires when Button is pressed
  • BTN_MSG_STILLPRESSED fires when Button is continuously pressed
  • BTN_MSG_RELEASED fires when Button is released after having been pressed
  • BTN_MSG_CANCELPRESS fires when Button is released going away from it while still pressing the touch panel

The "normal" event to test is BTN_MSG_RELEASED, that means user has chosen the corresponding GUI option.

Let's say this option means "go to screen SCREEN1", which is another screen in your GUI.

Well, all you have to do is to select the Button by clicking on it: its events will be highlited on the Events frame in the upper right of VGDD.

Now double click on BTN_MSG_RELEASED and the Events editor will show up. Check the checkbox and then the edit window will be enabled.

Here you can write your own code, or simply use the code snippets by selecting which object to interact with (in our case SCREEN1) and then choose the appropriate action in the other combobox (Goto Screen).

By clicking on "Insert code" VGDD will insert the corresponding (simple, in this example) code:


For an explanation of screenState, see Screen States

Code associated to every single event can be as simple as the above example or became more complex like in the following screenshot:

VGDD Event.png

Screens do have their own events, see the Screen Events section