Google

SECTION 2.8 - THE POP-UP DIALOGUE BOX ROUTINES

2.8.1 INTRODUCTION

The pop-up dialog box view-object is used to request the immediate input of a text string in response to a prompt. The program will only proceed after the user has input a reply (or pressed the Escape key to abort the input). It is typically used to input information such as a file name. If possible, the use of this view-object should be avoided as it 'grabs the keyboard and the pointer' and alternatives such as a control view-object with a Panel I/O item should be considered.

The following sets of routines are available:

Creating and Handling a Pop-up Dialogue Box View-Object

2.8.2 CREATING AND HANDLING A POP-UP DIALOGUE BOX VIEW-OBJECT

2.8.2.1 Introduction

The following routines are available:

Display a pop-up dialog box - xdl_popup_dialog

2.8.2.2 Display a pop-up dialog box - xdl_popup_dialog

The routine xdl_popup_dialog (xdlf_popup_dialog) is used to display a pop-up dialog box containing a prompt and to wait till a reply is input (or the Escape key is pressed to abort the input). Note that the pop-up dialog box is rather different from most other view-objects in that it is a temporary object and does not have a view-object handle.
 
Fortran call:
 
         CALL XDLF_POPUP_DIALOG (IXROOT, IYROOT, PROMPT, LENP, 
        +                        IWIDTH,
        +                        REPLY, LENR,
        +                        IFONT, IARROW, IRETURN)
 
Parameters:
 
IXROOT    (R)  X (rootwindow) position for dialog (top left) 
               (see xroot)
IYROOT    (R)  Y (rootwindow) position for dialog (top left)
               (see yroot)
PROMPT    (R)  Address of character string containing the prompt.
               ** Pass address using the XDLSTR function **
               (see prompt)
LENP      (R)  Length of the PROMPT character string (>0) 
               (cf lenp)
IWIDTH    (R)  Width of box as the number of characters in
               the prompt string + the number to be displayed
               in the reply string (note: the reply string can 
               be scrolled using the cursor left and right keys)
               (see width)
REPLY     (W)  Address of character string to contain the reply
               message.
               ** Pass address using the XDLSTR function **
               (see reply)
MAXLEN    (R)  Maximum length for the returned reply string (>0).
               (cf max_len)
IFONT     (R)  Font type (1 to 5, very small to extra large) 
               (see font_type)
IBOLD     (R)  =0 Prompt and input string in normal text
               =1 Prompt bold, input string normal
               =2 Prompt normal, input string bold
               =3 Both strings bold
               (see bold)
IARROW    (R)  =1 display an arrow pointing to the top left corner
               of the dialog box provided that it can be placed 
               in the requested position, =0 do not. (see arrow)
IRETURN   (W)  Return flag = 0 Blank string
                           = 1 String returned (non-blank)
                           =-1 Input aborted (via Escape key)
                           =-2 Unable to allocate memory for
                               temporary input string
                           =-3 No room for an input string
 
'C' call:
 
int xdl_popup_dialog (xroot, yroot, prompt, lenp, width, reply, max_len, 
                      font_type, bold, arrow)
 
Parameters:
 
int xroot;          /* x position of the dialog popup area 
                       (wrt root) (R)*/
int yroot;          /* y position of the dialog popup area 
                       (wrt root) (R)*/
char * prompt;      /* Prompt string (R)*/
int lenp;           /* Length of prompt string. If 0 then the routine will
                       find the length assuming a null terminated 
                       string (R)*/
int width;          /* Width of box as the number of characters in
                       the prompt string + the number to be displayed
                       in the reply string (note: the reply string can 
                       be scrolled using the cursor left and right keys)
                       (R)*/
char * reply;       /* Address for returned string (W)*/
int max_len;        /* if >0 Maximum length of return string allowed
                             (excluding terminating null - reply must be
                             at least max_len+1 characters in length)
                       if <0 abs(max_len) characters will be returned
                             padded with blanks if needed (for 'fortran'
                             use) (R)*/
int font_type;      /* Font type 1 to 5, very-small to extra-large (R)*/
int bold;           /*  =0 Prompt and input string in normal text
                        =1 Prompt bold, input string normal
                        =2 Prompt normal, input string bold 
                        =3 Both strings bold  (R)*/
int arrow;          /* =1 draw arrow pointing to origin (provided that
                       dialog may be positioned where requested), =0 do
                       not (R)*/
Return:  = 0,  Blank reply
         = 1,  Text string was input
         =-1,  Input aborted
         =-2,  Unable to allocate memory for temporary input string
         =-3,  No room for an input string



John W. Campbell
CCLRC Daresbury Laboratory
Last update 4 Feb 1998