Home

Common Dialogs

These procedures allow access to simple dialogs from within C or Fortran. While they have been designed to be called with reference to a particular AppGraphics window, they can be called without any windows having been opened or initialized. In other words, a program that is normally only running in a text console may call these dialogs to, for example, prompt the user for a file selection without having any other windows opened.

dlgmessage

C void dlgmessage (type, message)
Fortran subroutine dlgmessage (type, message)

Description

Displays a simple message on the screen in a popup dialog with an “Ok” button. The message box may be of a type specified by the following constants:

Type Description
DIALOG_INFO Displays an information icon and title
DIALOG_WARN Displays a warning icon and title
DIALOG_ERR Displays an error icon and title

Parameters

Parameter C Type Fortran Type Description
type int integer The type of message box to display, as explained above
message const char * character(*) The message to display in the popup message box

dlgopenfile

C bool dlgopenfile (title, filename, filelength, maskdesc, mask)
Fortran function dlgopenfile (filename, maskdesc, mask, title)

Description

Displays a standard file selection dialog formatted for opening a file.

Parameters

Parameter C Type Fortran Type Description
title const char * character(*)1 The title to display in the file dialog
filename char * character(*) The initial file location to use when the dialog is displayed. Upon a successful return, the selected filename is held by this parameter
filelength int N/A The length of the filename variable
maskdesc const char * character(*)1 The description to display for the file mask if one was provided
mask const char * character(*)1 The file mask, normally an asterisk followed by the file extension

Return Value

C bool
Fortran logical

True if a file was selected, false otherwise. If a file was selected, the new filename will be present in the filename parameter. If a file was not selected, the contents of the filename parameter will remain unchanged.

int dlgrequestselection(char *items, const char *title, const char *label);

dlgrequestselection

C int dlgrequestselection (items, title, label)
Fortran function dlgrequestselection (items, title, label)

Description

Displays a popup dialog containing a list from which the user may select an item.

Parameters

Parameter C Type Fortran Type Description
items const char * character(*), dimension(:) The list of items to display. In C, the list should be a string where the items are separated by NULL characters and terminated with a pair of NULL characters.
title const char * character(*)1 The title to display in the file dialog
label const char * character(*)1 The text to display above the list in the dialog

Return Value

C int
Fortran integer

In C, the routine returns the 0-based index of the selected item. In Fortran, the routine returns the 1-based index of the selected item.

dlgrequesttext

C bool dlgrequesttext (text, textlength, title, label)
Fortran function dlgrequesttext (text, title, label)

Description

Displays a popup dialog requesting text input from the user.

Parameters

Parameter C Type Fortran Type Description
text char * character(*) The text to initially display in the box. If successful, this parameter will contain the text entered by a user
textlength int N/A The size of the text parameter
title const char * character(*)1 The title to display in the file dialog
label const char * character(*)1 The text to display above the text entry box in the dialog

Return Value

C bool
Fortran logical

True if successful, false otherwise. If successful, the text parameter will contain the user’s input. If unsuccessful, the contents of text will remain unchanged

dlgsavefile

C bool dlgsavefile (title, filename, filelength, maskdesc, mask)
Fortran function dlgsavefile (filename, maskdesc, mask, title)

Description

Displays a standard file selection dialog formatted for saving a file.

Parameters

Parameter C Type Fortran Type Description
title const char * character(*)1 The title to display in the file dialog
filename char * character(*) The initial file location to use when the dialog is displayed. Upon a successful return, the selected filename is held by this parameter
filelength int N/A The length of the filename variable
maskdesc const char * character(*)1 The description to display for the file mask if one was provided
mask const char * character(*)1 The file mask, normally an asterisk followed by the file extension

Return Value

C bool
Fortran logical

True if a file was selected, false otherwise. If a file was selected, the new filename will be present in the filename parameter. If a file was not selected, the contents of the filename parameter will remain unchanged.

bool dlgyesno(int type, const char *message);

dlgyesno

C bool dlgyesno (type, message)
Fortran function dlgyesno (type, message)

Description

Displays a popup dialog with “Yes” and “No” buttons. The message box may be of a type specified by the following constants:

Type Description
DIALOG_INFO Displays an information icon and title
DIALOG_WARN Displays a warning icon and title
DIALOG_ERR Displays an error icon and title

Parameters

Parameter C Type Fortran Type Description
type int integer The type of message box to display, as explained above
message const char * character(*) The message to display in the popup message box

Return Value

C bool
Fortran logical

True if “Yes” was clicked, false otherwise.

1 Optional named argument