inherits from Button;
Mode buttons stack along the right side of modal scenes. They allow the user to switch the scene from one mode to another.
Instantiate: sometimes Subclass: sometimesCall its methods: rarely
You'll rarely need to subclass class ModeButton. If you do, it will probably be to override Action.
Class ModeButton defines the following methods:
Method | Description |
---|---|
AboutToHide | Overridden to stop observing the target |
AboutToShow | Overriden to update the button's highlight state and begin observing its | target |
Action | Overridden to go to the enclosing scene of the target |
Notice | Overridden to update highlight state when target changes |
SetHilited | Overridden to ensure that self is not unhighlighted when it should be | highlighted, thus ensuring that pressing the button makes it highlight | and stay highlighted with no flicker |
ShouldBeHilited | Check if target's ViewMode matches modeValue field |
Class ModeButton defines the following fields
Field | Type | Description |
---|---|---|
Inherited from SingleLinkable | ||
next | Object | Next item in view list |
Inherited from Linkable | ||
previous | Object | Previous item in view list |
Inherited from Viewable | ||
superview | Viewable | Container for this object |
subview | Viewable | Object contained by this object |
relativeOrigin | Dot | Origin relative to superview |
contentSize | Dot | Size of content rectangle |
viewFlags | Unsigned | Property settings |
labelStyle | TextStyle | Text style of object's label |
color | Unsigned | Color of object's content |
altColor | Unsigned | Not used by button |
shadow | Shadow | Shadow drawn with object |
sound | Sound | Sound associated with object |
Inherited from Stamp | ||
image | Image | Image used to draw stamp |
Inherited from HasBorder | ||
border | Border | The button's border |
Defined by ModeButton | ||
target | Object | The object used by Action and ShouldBeHilited |
modeValue | Unsigned | The value of ViewMode that this button reflects and sets |
The target of a mode button should almost always be a modal scene. The mode value should be the number of the scene mode that is to be displayed when the button is tapped. Here's an example of a mode button used by the phone scene:
Instance ModeButton 'log' 5011; next: (ModeButton 'services' 5014); previous: (ModeButton 'names' 5009); superview: (PhoneScene 'Phone' 5000); subview: nilObject; relativeOrigin: <211.0,-1.0>; contentSize: <50.0,43.0>; viewFlags: 0x10101000; labelStyle: iBook10Bold; color: 0xFF000000; altColor: 0xFF000000; shadow: nilObject; sound: iTouchSound; image: {6,433}; border: iSquareButtonBorderUp; // BorderImage 3189 target: (PhoneScene 'Phone' 5000); modeValue: 3; End Instance;
The log mode button corresponds to mode 3 of the phone scene, which is a subclass of class ModalScene.
Class ModeButton defines just one attribute:
Attribute | Type | Description |
---|---|---|
Target | Object | The object used by Action and ShouldBeHilited; | interface to the target field |
overrides Action Call: rarely Override: sometimes
The system calls Action when the user taps on button. ModeButton_Action goes to enclosing scene of the button's target and sets the target's view mode to modeValue. Action assumes that the button's target is a modal scene (or some other class that implements a SetViewMode method).
Override Action to do something else when the button is pressed.