Human Interface Notes
_____________________________________________________________________________

Note #4:    Movable Modal Dialog Boxes

            Written by:  Scott Jenson                            January 1990
_____________________________________________________________________________

Discussion of a new modal window style that can be moved by 
dragging its title bar.
_____________________________________________________________________________

A standard modal dialog box works well as long as you, the developer, are 
asking such questions as "How do you want to print this document?" or 
"Save changes before quitting?"  However, sometimes you need to ask a 
question and the user needs to see the document contents to make a decision.  
A common example is a Find... or Replace... dialog box.  The usual rule of
choice is to use a modeless dialog box since 1) it's less intrusive on the
is to use a modeless dialog box since 1) it's less intrusive on the 
many different ways people may want to use your software, and 2) since it's
movable, the user can easily move it around to view covered parts of the 
document.  There are some cases, however, when the question or response 
task needs to be modal, but the user still might want to view what's behind 
the dialog box.  An example would be a complex attribute change like adding 
a border to a paragraph of text.  You might want to see the text or even 
other paragraphs while you're setting up the border.

In these cases use a movable modal dialog box.  This window design gives 
you visual feedback both that it is a modal dialog box and also that you 
can drag it from the title bar.

Figure 1 shows a simple example of this dialog box style.
           __________________________________________________
           ||-------------------Border Style----------------||
           ||-----------------------------------------------||
           ||    ____     ======     ++++++     ^^^^^^      ||
           ||    |        =          +          ^           ||
           ||    |        =          +          ^           ||
           ||    |        =          +          ^           ||
           ||                                               ||
           ||   ######    @@@@@       %%%%%%    &&&&&&&     ||
           ||   #         @           %         &           ||
           ||   #         @           %         &           ||
           ||   #         @           %         &           ||
           ||                                               ||
           ||                 _________      #########      ||
           ||                /  Cancel \    /   OK    \     ||
           ||                \_________/    \         /     ||
           ||                                #########      ||
           ||_______________________________________________||                           
           ||-----------------------------------------------||
                   
                   Figure 1 - Movable modal dialog box

A couple of points to keep in mind:

  o  Any selection made in the dialog box should 
     immediately update the document contents.  The OK 
     button  then means "accept this change" and the 
     Cancel button means "undo all changes done by this 
     dialog box."  Some applications use an Apply button 
     to approximate this behavior but this only confuses 
     the meaning of OK and Cancel.
  o  With this dialog box, it is not necessary to keep 
     your application from switching to other 
     MultiFinder layers.  System 7.0 uses this method to 
     show an application is busy with some time-
     consuming operation, yet can still be switched into 
     the background.
  o  When you create this dialog box, be sure to use 
     the new window type.  Do not draw a rect in a 
     documentProc.  System 7.0 has as new selector on 
     the standard 'WDEF' resource for this type of 
     window.  For System Software 6.0.x, you can obtain 
     a new 'WDEF' resource on AppleLink in the the Human 
     Interface section of the Developer Services 
     Bulletin Board or request a copy by writing to 
     AppleLink address MACINTERFACE.
  o  Make sure to save the position of the window for 
     the next time it's used.
  o  Do not use this dialog box when a modeless 
     dialog box would work instead.
