Quizzer::FrontEnd::Dialog - dialog FrontEnd
This FrontEnd is for a user interface based on dialog, whiptail, or gdialog. It will use whichever is available, but prefers to use whiptail if available. It handles all the messy communication with thse programs.
It currently uses only whiptail of gdialog, because dialog lacks --defaultno.
Creates and returns a new FrontEnd::Dialog object. It will look to see if whiptail, or dialog, or gdialog are available, in that order. To make it use dialog, set FORCE_DIALOG in the environment. To make it use gdialog, set FORCE_GDIALOG in the environment.
Dialog and whiptail have an annoying property of requiring you specify their dimentions explicitly. This function handles doing that. Just pass in the text that will be displayed in the dialog, and it will spit out new text, formatted nicely, then the height for the dialog, and then the width for the dialog.
Pass this some text and it will display the text to the user in a dialog. If the text is too long to fit in one dialog, it will use a scrollable dialog.
This is a helper function used by some dialog Elements. Pass it the Question that is going to be displayed. It will use this to generate a prompt, using both the short and long descriptions of the Question.
You can optionally pass in a second parameter: a number. This can be used to tune howe many lines are free on the screen.
If the prompt is too large to fit on the screen, it will instead be displayed immediatly, and the promnpt will be changed to just the short description.
The return value is identical to the return value of sizetext() run on the generate prompt.
Displays a dialog. All parameters are passed to whiptail/dialog.
If called in a scalar context, returns whatever dialog outputs to stderr. If called in a list context, returns the return code of dialog, then the stderr output.
Note that the return code of dialog is examined, and if the user hit escape or cancel, this frontend will assume they wanted to back up.
Joey Hess <firstname.lastname@example.org>