BrightSign HD2000 Object Reference Manual User Manual

Page 29

Advertising
background image

3. ifEvent (mouse events). ifEvent has the following member function:

a. rotINT32 GetEvent()


EnableRollover:

Use this function to enable a rollover for a touch region. It accepts the touch region’s ID, two strings
specifying the names of the on and off bitmap images, and a cache setting. The cache_image parameter
simply tells the script whether to keep the bitmaps loaded in memory. This is a good idea except that it
uses up memory very quickly so we recommend that cache_image is normally set to 0.

EnableRegion:

Use this function to enable or disable a rollover region. It accepts the touch region’s ID and a Boolean
value (true or false). The rollover regions default to enabled when created, but you can set up all of the
regions at the start of your script and then just enable the current ones when required.

SetRollOverOrigin:

The default requirement is that rollover bitmaps are the same size and position as the touch region
(though for circular regions the bitmap is obviously square). This function can be used to change the
origin, so that more (or less) of the screen changes when the mouse rolls in and out of the region. This
means that bitmaps which are larger than the region can be drawn. Note that the default origin for
circular regions is (x - r, y - r) where (x, y) is the center and r is the radius.


ClearRegion:

Clears the list of regions added using AddRegion so that any touches in those regions no longer
generate events. This call has no effect on the rollover graphics.


IsMousePresent:

Returns whether a relative pointing device is attached (i.e. not an absolute device like a touch screen).

Example: This code loops a video and waits for a mouse click or touch screen input. It
outputs the coordinates, to the shell, of the click or touch, if it’s within the defined region.

v=CreateObject("roVideoPlayer")
t=CreateObject("roTouchScreen")
p=CreateObject("roMessagePort")

v.SetPort(p)
t.SetPort(p)
v.SetLoopMode(1)
v.PlayFile("testclip.mp2v")

t.AddRectangleRegion(0,0,100,100,2)

loop

:

msg=wait(0, p)
print "type: ";type(msg)
print "msg=";msg

if

type(msg)="roTouchEvent"

then

print "x,y=";msg.GetX();msg.GetY()

endif

goto

loop

:


Another Example with Mouse support:
t=CreateObject("roTouchScreen")

29

Advertising
This manual is related to the following products: