Rogue Wave Views Gadgets > Dialogs > Predefined Dialog Boxes
 
Predefined Dialog Boxes
The Gadgets library provides the following classes for defining standard dialog boxes:
*IlvIMessageDialog
*IlvIQuestionDialog
*IlvIErrorDialog
*IlvIWarner
*IlvIInformationDialog
*IlvIFileSelector
*IlvFileChooser
*IlvIPromptString
*IlvFontSelector
*IlvColorSelector
*IlvGradientSelector
IlvIMessageDialog
A message dialog box (IlvIMessageDialog class) includes a message text field, a bitmap, and two buttons.
Figure 10.2    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.
Figure 10.3    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.
Figure 10.4    An Error Dialog Box
IlvIWarner
A warning dialog box (IlvIWarner class) displays a warning message.
Figure 10.5    A Warning Dialog Box
IlvIInformationDialog
An information dialog box (IlvIInformationDialog class) displays an information message.
Figure 10.6    An Information Dialog Box
IlvIFileSelector
A file selector (IlvIFileSelector class) asks the user to select a file name.
Figure 10.7    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.
Figure 10.8    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.
Figure 10.9    A Prompt String
IlvFontSelector
A font selector (IlvFontSelector class) asks the user to select a font.
Figure 10.10    A Font Selector
IlvColorSelector
A color selector (IlvColorSelector class) asks the user to select a color.
Figure 10.11    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.
Figure 10.12    A Gradient Selector

Version 5.7
Copyright © 2013, Rogue Wave Software, Inc. All Rights Reserved.