Quickstart Guide

First, either attach the "OSW_behaviours", "OSW_Factories" and "OWS_Core" casts to your movie (or copy the contents to your movie).

Second, create a simple blank cast member that is the size you want your widget to be. Give this bitmap a regPoint of (0,0). Note that some widgets have limits to how high or wide the widget can be, so the size you want may not be honoured. If you set the regPoint to (0,0), the widget will always be positioned correctly.

Make a bitmap member and set its regpoint Make a bitmap member and set its regpoint

Position this bitmap on stage at the location you want, then attach the relevant behaviour. When you attach the behaviour, you can use the GetPropertyDescriptionlist dialog to configure the widget.

Configuring the Widget

The One-Sprite widgets can be configured via the GetPropertyDescriptionList dialog. The following is a sample dialog for a bevel button:

Sample GPDL Sample GPDL

All widgets have the same first five properties.

  • Default Event Message: This is the default event the widget will generate when it is activated or clicked. This can be changed using the SetEventMessage() method each widget inherits from the base-class.
  • Widget Ready Message: This is the message the widget will first broadcast when it is created. The ReadyMessage (like all messages sent by a widget) will always include a reference to the widget as the first parameter. The second parameter is the id (below)
  • WidgetID: This is parameter that is passed with the ReadyMessage. It can be used to group widgets. Otherwise, it can be ignored.
  • Broadcast Ready Message: If true, the ready message is sent to all sprites when the widget sprite begins.

Different classes of widget will offer other parameters (such as the label and font to use). [These will be documented eventually]

Interacting with the Widgets

Widgets generate 'event' messages when they are actived. These messages are sent to 'listeners'. In order to receive the event messages generated by the widget, other objects need to add themselves as listener objects to the widget using the common 'AddListener()' method. They can do this in response to the Ready Message. For example, the following behaviour will listen for a "TabPanelReady" message. Once received, it will use the reference to the TabWidget that is passed in to add itself as a listener. It also tells the tabwidget what list to display. When a tab is selected, the tab widget will send a "TabPanelSelect" message to listeners. This behaviour will respond to the TabPanelSelect message by going to the relevant marker.

on TabPanelReady (me, sender, id)

  -- set the list to display

  sender.SetTabs(the markerList)

  -- set the front tab

  sender.SetFrontTab( the framelabel)

  -- add this behaviour as a listener

  sender.AddListener(me)

end



on TabPanelSelect (me, sender, args)

  -- args will be a prop List [#Pos: int, #text: TabLabel]

  go to args.text

end

Callback Parameters

Widgets will always include a reference to themselves as the first parameter when sending event messages (this is useful if the listening object wishes to send a message back, such as "Change your label from 'Play' to 'Pause'). The second parameter is a property list. The contents of this property list will depend on which widget is activated.

First published 09/06/2005