Popup Windows

Popup windows are simple dialog boxes that get a simple yes/no or string answer from the user. When these windows popup, they block input to the previously active window.


int GetYesNo(char *question);

This function allows you to prompt the user for the answer to a simple yes or no type of question. It simply pops up a dialog box with the text contained in the string question, and two okay/cancel buttons.

If the user clicks Okay, this function returns TRUE. If the user clicks Cancel, this function returns FALSE. The text in the question string can have embedded newlines (\n characters) to break things up or to add spacing.

SEE ALSO : GetOkay() , GetTriState() , GetString()


int GetOkay(char *question);

This function is mainly for short informational displays. It pops up a dialog box with the text contained in the string question, and an okay button.

The text in the question string can have embedded newlines (\n characters) to break things up or to add spacing.

SEE ALSO : GetYesNo() , GetTriState() , GetString()


int GetTriState(char *question);

This function allows you to prompt the user for the answer to a simple yes or no type of question, and in addition, the user has a Cancel option. The dialog box contains the string pointed to by the argument question and it also contains three buttons, Yes, No and Cancel.

If the user clicks the Yes button, this function returns TRUE. If the user clicks the No button, this function returns FALSE. If the user clicks the Cancel button, a -1 is returned. It is important to keep in mind that you can't just test for true/false as you can with GetYesNo() since a return of Cancel would test as true (since it is a non-zero value).

The text in the question string can have embedded newlines (\n characters) to break things up or to add spacing.

SEE ALSO : GetYesNo() , GetOkay() , GetString()


char *GetString(char *msg, char *default);

This function allows you to prompt the user for a string of input. The first argument, msg, is a pointer to a string which will be displayed in the dialog box. The next argument, default, is the default string to place in the text string box (it can be NULL or "").

When you call this function, it pops up a small dialog box on the screen, and the user can enter the line of text. When the user clicks ok or cancel, the function returns a pointer to the string of text the user entered.

The string that is returned to your application is dynamically allocated with malloc(). It is the application's responsibility to free it when it is done.

If the user clicks cancel, you get a NULL return value.

SEE ALSO : GetYesNo()