Event loops – BrightSign Object Reference Manual (FW 5.1) User Manual

Page 12

Advertising
background image

4


When zones are enabled, the image layer is on top of the video layer by default. The default behavior can be modified
using the roVideoMode.SetGraphicsZOrder() method.

When zones are not enabled, the image layer is hidden whenever video is played, and the video layer is hidden whenever
images are played.

Event Loops

When writing anything more than a very simple script, an "event loop" will need to be created. Event loops typically have
the following structure:

1. Wait for an event.
2. Process the event.
3. Return to step 1.


An event can be any number occurrences: a button has been pressed; a timer has been triggered; a UDP message has
been received; a video has finished playing back; etc.

By convention, event scripting for BrightScript objects follows this work flow:

1. An object of the type roMessagePort is created by the user’s script.
2. Objects that can send events (i.e. those that support the ifMessagePort/ifSetMessagePort interface) are instructed

to send their events to this message port using the

SetPort() method. You can set up multiple message ports

and have each event go to its own message port, but it is usually simpler to create one message port and have all
the events sent to this one port.

3. The script waits for an event. The actual function to do this is ifMessagePort.WaitMessage(), but the built-in

Wait() statement in BrightScript allows you to do this more easily.

Advertising