Object <- Viewable <- Control <- Meter <- ChoiceBox |
|
|
Choices Level LevelText LevelText Max Selected |
| Field | Type | |
|---|---|---|
| Viewable: | superview: | Viewable |
| relativeOrigin: | Dot | |
| contentSize: | Dot | |
| viewFlags: | Flags | |
| labelStyle: | TextStyle | |
| color: | Unsigned | |
| altColor: | Unsigned | |
| shadow: | Shadow | |
| sound: | Playable | |
| HasBorder: | border: | Border |
| Control: | image: | Image |
| textStyle: | TextStyle | |
| controlFlags: | Unsigned | |
| level: | Fixed | |
| min: | Fixed | |
| max: | Fixed | |
| target: | Object | |
| targetAttribute: | OperationNumber | |
| Meter: | upDownImages: | Object |
| ChoiceBox: | choices: | Object |
| lastOneEditable: | Boolean | |
| resetValue: | Boolean | |
| transientChoices: | Boolean | |
| choiceObjects: | Boolean | |
| matchByName: | Boolean | |
| useObjectIndex: | Boolean | |
| choiceWrap: | Boolean | |
| maxFromChoices: | Boolean | |
| useObjectAttribute: | Boolean | |
| matchWithSameChoice: | Boolean | |
| neverAdjustBoxSize: | Boolean | |
| lookForGroup: | Boolean | |
| destroyChoices: | Boolean | |
| numericText: | Boolean | |
| hasOtherChoiceObject: | Boolean |
instance ChoiceBox tag; relativeOrigin: <0.0,0.0>; contentSize: <0.0,0.0>; viewFlags: 0x00000000; labelStyle: nilObject; color: 0; altColor: 0; shadow: nilObject; sound: nilObject; border: nilObject; image: nilObject; textStyle: nilObject; controlFlags: 0; level: 0; min: 0; max: 0; target: nilObject; targetAttribute: nilOperation; upDownImages: nilObject; choices: nilObject; lastOneEditable: false; resetValue: false; transientChoices: false; choiceObjects: false; matchByName: false; useObjectIndex: false; choiceWrap: false; maxFromChoices: false; useObjectAttribute: false; matchWithSameChoice: false; neverAdjustBoxSize: false; lookForGroup: false; destroyChoices: false; numericText: false; hasOtherChoiceObject: false; end instance;
Define Class ChoiceBox; inherits from Meter; field choices: Object; field lastOneEditable: Boolean; // user can edit arbitrary text in last position field resetValue: Boolean; // set level back to Min(self) in AboutToShow field transientChoices: Boolean; // IntegerAttribute/ObjectAttribute(target, targetAttribute) for choices // when AboutToShow, Destroy when AboutToHide (generally used with maxFromChoicesMask) field choiceObjects: Boolean; // Choices(self) is a list of objects, as opposed to a text object field matchByName: Boolean; // use searchByName instead of search to correlate with list field useObjectIndex: Boolean; // use index of object as current value field choiceWrap: Boolean; // wrap around instead of pinning field maxFromChoices: Boolean; // Max(self) is computed from length of Choices (objectlist or text) field useObjectAttribute: Boolean; // use target attribute of selected object as current value field matchWithSameChoice: Boolean; // use IsSameChoice to compare choice list elements with attribute from target field neverAdjustBoxSize: Boolean; // don't allow AdjustSize to change the choice box bounds field lookForGroup: Boolean; // set if a group's list matches the attribute; // special-case used by PeopleList (could be subclass) field destroyChoices: Boolean; // if set, destroy choices in choice list instead of just clearing the list field numericText: Boolean; // convert choice list text to numeric attribute field hasOtherChoiceObject: Boolean; // whether there's currently an "other choice" object attached to the choices // set to false in instance definition attribute Choices: Object; attribute Selected: Object, safe; operation ItemSelected(theIndex: UnsignedShort); operation UpdateChoices(); // tell ChoiceBox that Choices list has been changed operation ShowChoiceMenu(); operation MenuShowing(): Boolean; operation CreateOtherChoiceNear(nearThis: Object): Object; // create a new, editable choice object // must override if lastOneEditable and choiceObjects are set // don't call inherited // the object will be created to extract its name and then // recreated if the other choice is confirmed operation ConfirmOtherChoice(name: HasText); // default is to create the other choice and add to the choices list // if it has a name that didn't exist before overrides BumpValue; overrides LevelText, SetLevelText; overrides TextFromValue; overrides AboutToHide, AboutToShow; overrides AdjustSize; overrides ControlsActive; overrides ControlsWrap; overrides DrawControlMechanism, ValueBox; // handle border around center to make it look touchable overrides ValueAsText; overrides Max; overrides PushLevel; overrides ApplyText; overrides SetLevel; overrides UpdateLevel; overrides Confirm; #ifdef VALIDATE overrides Validate; #endif end class;