Predefined Dialog Boxes
The Gadgets library provides the following classes for defining standard dialog boxes:
IlvIMessageDialog
A message dialog box (IlvIMessageDialog class) includes a message text field, a bitmap, and two buttons.
A Message Dialog Box
Note
By default, this dialog does not include a bitmap. Therefore, you have to provide one. |
IlvIQuestionDialog
A question dialog box (IlvIQuestionDialog class) displays a question and expects a yes or no answer.
A Question Dialog Box
Here is a code example for a question dialog box:
{
IlvIQuestionDialog dlg(getDisplay(), msg, 0,
IlvDialogOkCancel, transientFor);
dlg.setString("dialog message");
if (dlg.get()) ...
}
This code creates a dialog box named dlg that will be destroyed after its use. This dialog box will be transient for the view specified by transientFor. It has two buttons, Ok and Cancel. The method get opens the dialog box and waits for the result. This method returns IlTrue if Ok is chosen, and IlFalse otherwise.
IlvIErrorDialog
An error dialog box (IlvIErrorDialog class) displays an error message.
An Error Dialog Box
IlvIWarner
A warning dialog box (IlvIWarner class) displays a warning message.
A Warning Dialog Box
IlvIInformationDialog
An information dialog box (IlvIInformationDialog class) displays an information message.
An Information Dialog Box
IlvIFileSelector
A file selector (IlvIFileSelector class) asks the user to select a file name.
A File Selector
Here is an example of using a file selector:
filesel = new IlvIFileSelector(display, 0, "*.cc");
filesel->setName("File Chooser");
filename = filesel->get();
if (filename && filename[0] && IlvFileExists(filename)) ...
Note
If you want to use the file selector specific to the platform you are working on, use either the IlvFileSelector or the IlvFileBrowser class. |
IlvFileChooser
A file chooser (IlvFileChooser class) asks the user to choose a file to open.
A File Chooser
Here is an example of using a file chooser to open a file which includes filename filters:
IlvFileChooserOptions* opt = new IlvFileChooserOptions(IlvFileChooserOpen);
opt->addFilter("All files (*.*)","*");
opt->addFilter("Ilv files (*.ilv)","ilv");
opt->addFilter("Iva files (*.iva)","iva");
opt->addFilter("Views files (*.iva,*.ilv)","iva|ilv");
dlg = new IlvFileChooser(getDisplay(),0,0,opt);
if (dlg->get() > 0) {
IlString filename = dlg->getResult(0);
if ((filename. getLength() > 0) && IlvFileExists((const char*)filename)) {
...
}
}
delete dlg;
IlvIPromptString
A prompt string (IlvIPromptString class) asks the user to select or to type a string.
A Prompt String
IlvFontSelector
A font selector (IlvFontSelector class) asks the user to select a font.
A Font Selector
IlvColorSelector
A color selector (IlvColorSelector class) asks the user to select a color.
Color Selectors with Color Names (Left) and with a Color Wheel (Right)
IlvGradientSelector
A gradient selector (IlvGradientSelector class) asks the user to select a gradient pattern.
A Gradient Selector