[comp.sys.apple] Orca/C Dialog Problem

STEIN@UCONNVM.BITNET (Alan Stein) (07/31/89)

  I am trying to create a dialog box using Orca/C.  Without any examples
in the documentation, I am having some difficulty.  The following code
creates a box but the box is empty and the program hangs.  I'd appreciate
it if someone either pointed out my glaring errors or sent a sample of
a dialog creation.

/****************************************************************
*
* FileNew - Open a New File
*
****************************************************************/
static void FileNew ()
{

char    name[255];

static ItemTemplate okbutton =
       { 1, 60, 60, 72, 360, buttonItem, "\pOK", 0, 0, NULL };

static ItemTemplate cancelbutton =
       { 2, 120, 150, 140, 350, buttonItem, "\pCancel", 0, 0, NULL };

static ItemTemplate message =
       { 3, 80, 100, 92, 300, itemDisable+statText, "\pClass Name", 0, 0, NULL }

static ItemTemplate inputline =
       { 4, 60, 60, 92, 300, editLine, NULL, 255, 0, NULL };

static DialogTemplate dialogRec =       /* dialog box    */
       { 50, 50, 150,450, 1, 0, NULL, NULL, NULL, NULL, 0 };

GrafPortPtr dialogptr;
Word        result;

dialogRec.dtItemList[0] = (ItemTempPtr) &okbutton;
dialogRec.dtItemList[1] = (ItemTempPtr) &cancelbutton;
dialogRec.dtItemList[2] = (ItemTempPtr) &message;
dialogRec.dtItemList[3] = (ItemTempPtr) &inputline;

dialogptr = GetNewModalDialog (&dialogRec);

result = ModalDialog(0);
while (result != 1 || result != 2)
        result = ModalDialog(0);

if (result == 1)
        {
        GetIText(dialogptr,4,name);
        }
CloseDialog(dialogptr);

} /* FileNew */


Alan H. Stein              | stein@uconnvm.bitnet
Department of Mathematics  | stein%uconnvm.bitnet@mitvma.mit.edu
University of Connecticut  | ...psuvax1!UCONNVM.BITNET!STEIN
32 Hillside Avenue         |
Waterbury, CT 06710        | Compu$erve  71545,1500
(203) 757-1231             | GEnie       ah.stein