tbar4 ----- from http://www.ti.com/calc/docs/act/92gui.htm ------------ TI-92 "A pop-up menu is useful when you need the user to select one item from a predetermined list." Creating Pop-ups, Toolbars, and Dialog Boxes Several of the features that are part of the TI-92 user interface (including pop-up menus, toolbars, and dialog boxes) can also be created in user programs. Whether you are creating a pop-up menu, a toolbar, or a dialog box, if a string is used it may be either a direct string, a named variable, an indirect variable, a concatenated string, or a combination of these types. Pop-up Menus A pop-up menu is useful when you need the user to select one item from a predetermined list. Examples of pop-up menus on the TI-92 include the MATH, CHAR, and APPS pop-ups. When you create a pop-up menu, it will look slightly different from the built-in pop-ups: the pop-up menu you create will not include a title. The syntax for a pop-up menu is: PopUp itemList, var The itemList is a list of strings consisting of a maximum of 30 characters each. (The number of strings is limited by memory.) The strings are displayed in the center of the screen similar to the dropdown part of a toolbar. The user can select from the list using the arrow keys or by pressing the number or letter preceding the desired item. The item number that the user selects is stored in var. If the variable var contains a value between 1 and the number of items in the list, then that value will be used to determine the default item when the pop-up is displayed. After the user selects an item from the list and presses Enter, the index of that item (1 for the first item, 2 for the second, and so on) is stored into the variable var. If the user presses Esc to terminate the pop-up, then the value of var is not changed. Toolbars All applications on the TI-92 have a toolbar at the top of the screen. You can also define a toolbar for programs that you create on your TI-92. There are two types of toolbars: custom (activated using the [Custom] key on the TI-92, 2nd [CUSTOM]) program (defined within a program) For more information about custom toolbars, see Creating Toolbars for the [CUSTOM] Key. A program toolbar is very similar to a custom toolbar. There are two main differences: 1.A program toolbar can have pictures in it. (See the program tbar4.92p in the downloadable example below.) 2.A program toolbar must have a label associated with each item or top-level item (Title) that does not have items underneath it. For example: :ToolBar : Title "No items (goto l1)",l1 : Title "Items" : Item "goto label a",a : Item "goto label b",b :EndTBar :disp šESC pressed" : Return :Lbl l1 : Disp "F1 pressed" : Return :Lbl a : Disp "F2, 1 pressed" : Return :Lbl b : Disp "F2, 2 pressed" : Return This program creates a toolbar that looks like this: The same restrictions that apply to custom toolbars apply to program toolbars: The number of titles or items is limited by memory. Each string in a title or item is limited to 30 characters. Example You can download this program for a toolbar example. tbar4.92p Dialog Boxes A dialog box is useful when you need the user to select or input several different items at one time. Examples of dialog boxes on the TI-92 include the MODE screen and the SAVE COPY AS or OPEN dialog boxes, available in most applications. A dialog box is generated by a Dialog statement followed by one or more Title, DropDown, Request, or Text statements and terminated by an EndDlog statement. For example: :Dialog :Title "The title" :Text "Static text" :DropDown "A dropdown", {"a","b","c"},dvar :Request "A request",reqvar :EndDlog :If ok=0:Return This program creates a dialog box that looks like this: The Title statement creates a title (maximum 50 characters) for the dialog box. All subsequent statements in the dialog box must be placed on a separate line. The number of statements in a dialog box is limited by the height of the display but there can be a maximum of 9 DropDown statements or 7 Request statements. If both DropDown and Request statements are included, the maximum number allowed for each type decreases. The Text statement defines static text that is displayed but not accessible by the user of the dialog box. This statement cannot exceed 34 characters and displays on the first line of the dialog box. The DropDown statement is similar to PopUp except that DropDown includes a prompt string. As with pop-ups, the index of the item selected in the DropDown list is assigned to the variable required in the statement. The number of characters in the prompt plus the number of characters in the longest string of the dropdown list can not exceed 35 characters. The number of items in the DropDown list is limited only by memory. The Request statement consists of a prompt string (20 characters maximum) and a variable name. This creates an edit field that allows the user to enter up to 255 characters. The resulting characters are stored into the variable as a string type. If the variable contains an existing string, it is used as the default value of the edit field (but it is first truncated to 255 characters). If the user closes the dialog box by pressing Enter, then all of the user-supplied values are assigned to the variables in the dialog box and the system variable ok is assigned the value 1. If the user closes the dialog box by pressing the Esc key instead, no values are assigned to the variables in the dialog box and ok is assigned the value 0. The Request statement in a dialog box may also be used as a stand-alone statement outside of a dialog box. In this case, the statement creates a dialog box with no title and the Request statement as its only entry. As with the dialog box, pressing Enter assigns 1 to ok and pressing Esc assigns 0 to ok. For example: :© Force user to enter a name :0 Ok :"name" ReqVar :while Ok = 0 : Request "Please enter your name", ReqVar :EndWhile Examples You can download these programs for examples of dialog boxes. base.92p conv.92p