The "template" application you write can be very useful in checking out the fine points of X features; you may want to save copies of one or more of the evolving versions.
You should have read Chapter 2.1-2.3 in Nye and O'Reilly, Vol. 4, before starting this exercise.
Draw the instance hierarchy on a sheet of paper. [Hint: it should specify three things for each widget in the program -- class, widget variable name, and widget instance name.]
In fill_box, note the use of (void) before each call to XtCreateManagedWidget that instantiates a new Label.
Use your knowledge of C to explain what effect this has, and what the advantage of doing it this way is.
Could the Boxes have been created in the same way? Why or why not?
toplevel (Shell)
"...instance name..."
|
box1 (Box)
" "
|
----------------------------
| |
button (Command) box2 (Box)
"Click to Quit" " "
|
-------------------------
| |
box3 (Box) title (Label)
" " "Long Label Goes Here"
Clicking the button should quit the application. The application should
rely entirely on X's default resource values (that is, you do not need
any resource file). Streamline your application so that it has the
fewest number of statements possible to accomplish the needed actions,
but do not sacrifice readability.
From the appearance of the Boxes, deduce what rules X uses to set the default size.
According to X conventions, what should the name of the resource file for this application be?
If any of the resource settings must be hardcoded, justify why.