Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pt/ptprompt.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pt/ptprompt.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pt/ptprompt.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pt/ptprompt.html on line 8

PtPrompt()

Display a message and get textual input from the user

Synopsis:

int PtPrompt( PtWidget_t *parent,
              PhPoint_t const *location,
              char const *title,
              PhImage_t const *image,
              char const *message,
              char const *msgFont,
              int btnCount,
              char const **buttons,
              char const **btnFonts,
              int defBtn,
              int escBtn,
              short textLength,
              char *text,
              char const *textFont,
              PhDim_t const *text_dim,
              int flags );

Arguments:

parent
A pointer to the parent widget of the dialog (usually a window). By setting the flags, you can block the parent and/or position the dialog relative to it.
location
A pointer to a PhPoint_t structure that specifies the location of the dialog relative to the parent or console, depending on the flags. If location is NULL, the dialog is centered.
title
The title for the dialog. If you don't want a title bar, set this argument to NULL.
image
A pointer to a PhImage_t structure that specifies an icon to display beside the message. If you don't want an icon, set this argument to NULL.
message
The message to display.
msgFont
The font for the message text; the default is TextFont09. You should create the font name by calling PfGenerateFontName().
btnCount
The number of buttons to display
buttons
A pointer to an array of strings to be displayed in the buttons. This array must contain at least btnCount strings.

All the button-text arguments let you define shortcut keys. Place an ampersand (&) in front of the character that you want to be the shortcut. For example, if you specify &Yes, the Y is underlined in the button, and you can press y or Y to select the button.

btnFonts
A pointer to an array of strings naming the fonts to be used in the buttons. If this argument is NULL, TextFont09 is used for all the buttons. Otherwise, this array must contain at least btnCount font names. You should create the font names by calling PfGenerateFontName().
defBtn
The number of the button that initially has focus when the dialog is realized.
escBtn
The number of the button that's bound to the Esc key. If you wish to disable the Esc key, set this argument to 0. If Esc is enabled, the close button is included in the dialog's titlebar (if there is one). Closing the dialog in this manner is the same as pressing the Esc key; the dialog closes and the escBtn button is selected.
text
A pointer to a buffer that sets the intitial textbox text, and in which the text is stored.

Note: You need to initialize this buffer, or unwanted characters may appear in the text box.

textLength
The size of the text buffer, in bytes.
textFont
The name of the font to use for the text. You should create the font name by calling PfGenerateFontName().
text_dim
A pointer to a PhDim_t structure that specifies the dimensions of the text-input area.
flags
Flags that define the behavior for the dialog. This can be up to one of the following:

with any combination of the following:

Pt_BLOCK_ALL overrides Pt_BLOCK_PARENT.

Library:

ph

Description:

PtPrompt() displays a dialog that prompts you for input, and can contain any number of buttons so that you can respond. This function is similar to PtAlert(), but lets you type a line of text. PtPrompt() works modally, which means that it doesn't return until you choose a button.


PtPrompt() dialog


A sample dialog displayed by PtPrompt().

Returns:

The number of the button pressed, or -1 if an error occurred.

Examples:

int answer;
char const *btns[] = { "&OK", "&Cancel" };
char text[31]="Default text";

answer = PtPrompt( base_wgt, NULL, "Identify yourself!", NULL,
        "Enter your name:", NULL, 2, btns, NULL, 1, 2,
        30, text, NULL, NULL, 0 );

switch( answer ) {

    case 1:
        /* ok */
        printf("You pressed OK and typed: %s\n", text);
        break;

    case 2:
        /* cancel */
        break;

    case -1:
        printf("An error occurred.\n");
        break;

}

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

ApError(), PfGenerateFontName(), PhDim_t, PhImage_t, PhPoint_t, PtAlert(), PtNotice(), PtPassword()

Dialog modules in the Working with Modules chapter of the Photon Programmer's Guide


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pt/ptprompt.html on line 333

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pt/ptprompt.html on line 333