WORD do_dialog( OBJECT *tree, WORD first_edit ) { GRECT g; WORD ret; /* Reserve screen/mouse button */ wind_update( BEG_UPDATE ); wind_update( BEG_MCTRL ); /* Center dialog on screen and put clipping rectangle in g */ form_center( tree, &g.g_x, &g.g_y, &g.g_w, &g.g_h ); /* Reserve screen space and draw growing box */ form_dial( FMD_START, 0, 0, 0, 0, g.g_x, g.g_y, g.g_w, g.g_h ); form_dial( FMD_GROW, g.g_x + g.g_w/2, g.g_y + g.g_h/2, 0, 0, g.g_x, g.g_y, g.g_w, g.g_h ); /* Draw the dialog box */ objc_draw( tree, ROOT, MAX_DEPTH, g.g_x, g.g_y, g.g_w, g.g_h ); /* Handle dialog */ ret = form_do( tree, first_edit ); /* Deselect EXIT button */ tree[ret].ob_state &= ~SELECTED; /* Draw shrinking box and release screen area */ form_dial( FMD_SHRINK, g.g_x + g.g_w/2, g.g_y + g.g_h/2, 0, 0, g.g_x, g.g_y, g.g_w, g.g_h ); form_dial( FMD_FINISH, 0, 0, 0, 0, g.g_x, g.g_y, g.g_w, g.g_h ); /* Release screen/mouse control. */ wind_update( END_MCTRL ); wind_update( END_UPDATE ); /* Return the object selected */ return ret; }