Tutorial Three: Creating a Dialog
In this tutorial, you will create an interface containing a BulletinBoard and two PushButtons. Clicking one PushButton will exit the application. Clicking the other will cause a dialog to appear. The dialog will consist of a BulletinBoard and a PushButton. Clicking this PushButton will dismiss the dialog.
Clear the Builder Xcessory display by selecting New from the Browser File menu.
Note: This tutorial assumes that you have chosen C as your language.
Creating Objects
Create a BulletinBoard and two PushButton children. If you are uncertain about how to do this, review See Creating and Resizing a Widget Instance and See Placing a Child Widget .
Creating a Dialog Shell
To create the dialog shell as a child of the bulletinBoard:
Completing the Collection
At this point you would add whatever widgets were to make up the dialog as descendents of bulletinBoard1. The dialog described in the remainder of this tutorial contains a single PushButton that dismisses the dialog. If you wish, you can experiment with Builder Xcessory and customize your own dialog for this example.
Adding a PushButton
Add a PushButton as the child of bulletinBoard1. This PushButton is created on the Browser object instance hierarchy as pushButton2.
The object instance hierarchy of your interface, displayed on the Browser, should now appear like the following figure:
Dialog Collection Instance Hierarchy
Editing Resources
Now you will use the Resource Editor or Builder Xcessory's extended editors to set widget resources. If you are uncertain about these procedures, review Using an Extended Editor and Setting Callback Resources .
labelString = DIALOG
activateCallback = DialogCallback()
labelString = EXIT
activateCallback = BxExitCB(0)
labelString = DISMISS
activateCallback = DismissCallback()
Your interface should now appear like the following figure:
Top Level of Interface
Creating a Global Widget
You will now set bulletinBoard1 to have a Global scope, so that it can be referenced in the PushButton's DialogCallback.
Generating Code
Save the interface code by writing a combination of C and UIL files. Then edit the file containing the callback structures to connect the functionality of the interface.
Save the UIL file and generate C code for your interface. If you have questions about these procedures, review Generating Code .
Confirming the Global Widget
Load <tutorial_path>/Tut3/creation-c.h
into a text editor.
Observe that the following structure has been generated:
Close the file.
Editing the Callback Structures
callbacks-c.c
, with your additions marked in bold, should now look like this:<tutorial_path>/Tut3/callbacks-c.c
into a text editor.Compiling and Running
Compile and run your program. If you have questions about these procedures, review Compiling and Running .
Testing the Interface
The application shell collection should appear on the screen.
Pop-up Dialog
You have now completed Tutorial Three.