This shows an example of building a user interface using the ScreenBuilder Application and the SYSTEM widget. The program builds a game called "Bomb Squad" in which you pretend you have a bomb wired with ten wires.
-
If you disconnect the correct four wires, the bomb is disarmed
-
If you disconnect the wrong two wires, the bomb explodes
-
The other four wires are inactive and disconnecting causes no action
In addition, the bomb is ticking as you try to disarm it. If you do not disarm it in time, the bomb explodes. A typical display to begin the game follows. Click the >> bar to view the description and steps of this example.
NOTE
Steps to Build the Interface
We will build the interface for this game with ten TOGGLEBUTTONs (the wires), a CLOCK widget set to TIMER mode (the bomb timer), and a PRINTER widget (for user feedback). We will use the ScreenBuilder application to design the user interface.
Here are the steps to build the interface:
Step 1. Start the ScreenBuilder Application
-
Configure the parent
PANEL widget from the one provided by the ScreenBuilder
-
Select "Re-name" in the Widget menu and enter "Main" as the new name
-
Select "Edit" in the Widget menu and set the following attributes. Click the Close button after setting each attribute.
- TITLE to "BOMB SQUAD Game"
- MAXIMIZABLE and RESIZABLE to FALSE
- SYSTEM MENU to the string "Quit"
A typical display of the ScreenBuilder output (the modified PANEL widget) follows.
Step 2. Create Ten TOGGLEBUTTONs
Create the first button by clicking on the
TOGGLEBUTTON icon, selecting "Main" as its parent and "T1" as its name. Create the other nine TOGGLEBUTTONs by choosing "Copy" in the Widget menu and selecting "Main/T1" as the widget to copy. When the Copy dialog appears, request nine copies in the Y-direction with zero spacing, beginning with the name "T2".
Use the "Edit" menu entry to set the LABEL attribute of the ten TOGGLEBUTTONs with pathnames "Main/T1" hrough "Main/T10" to "Wire 1" through "Wire 10".A typical display.follows.
Step 3: Create a CLOCK Widget
Create a
CLOCK widget by clicking on the CLOCK icon and setting its name to "Clock" (pathname "Main/Clock"). Use the mouse to relocate it and make it "flatter". Set its TYPE attribute to TIMER. A typical display follows.
Step 4. Create the Final Interface
Create a
PRINTER widget by clicking on the PRINTER icon and setting its name to "Printer" (pathname "Main/Printer"). Resize it and relocate it. A typical display of the game's final user interface.follows.
Step 5. Save the Interface in a File
Select the "Save As:" entry of the ScreenBuilder's File menu, and store this interface in the file "EX_BSQUAD.SCR". This completes the ScreenBuilder Application Example. See
ScreenBuilder Application to return to the ScreenBuilder topics.