Common Dialogs classes and functions


Classes

class  Fl_Color_Chooser
 The Fl_Color_Chooser widget provides a standard RGB color chooser. More...
class  Fl_File_Chooser
 The Fl_File_Chooser widget displays a standard file selection dialog that supports various selection modes. More...

Functions

void fl_alert (const char *fmt,...)
 Shows an alert message dialog box.
int fl_ask (const char *fmt,...)
 Shows a dialog displaying the fmt message, this dialog features 2 yes/no buttons.
void fl_beep (int type)
 Emits a system beep message.
int fl_choice (const char *fmt, const char *b0, const char *b1, const char *b2,...)
 Shows a dialog displaying the fmt message, this dialog features up to 3 customizable choice buttons.
int Fl_Color_Chooser::fl_color_chooser (const char *name, uchar &r, uchar &g, uchar &b, int cmode)
 Pops up a window to let the user pick an arbitrary RGB color.
int Fl_Color_Chooser::fl_color_chooser (const char *name, double &r, double &g, double &b, int cmode)
 Pops up a window to let the user pick an arbitrary RGB color.
char * Fl_File_Chooser::fl_dir_chooser (const char *message, const char *fname, int relative)
char * Fl_File_Chooser::fl_file_chooser (const char *message, const char *pat, const char *fname, int relative)
void Fl_File_Chooser::fl_file_chooser_callback (void(*cb)(const char *))
void Fl_File_Chooser::fl_file_chooser_ok_label (const char *l)
const char * fl_input (const char *fmt, const char *defstr,...)
 Shows an input dialog displaying the fmt message.
void fl_message (const char *fmt,...)
 Shows an information message dialog box.
Fl_Widgetfl_message_icon ()
 Gets the Fl_Box icon container of the current default dialog used in many common dialogs like fl_message(), fl_alert(), fl_ask(), fl_choice(), fl_input(), fl_password().
const char * fl_password (const char *fmt, const char *defstr,...)
 Shows an input dialog displaying the fmt message.

Variables

static void(* Fl::error )(const char *,...) = ::error
 FLTK calls Fl::error() to output a normal error message.
static void(* Fl::fatal )(const char *,...) = ::fatal
 FLTK calls Fl::fatal() to output a fatal error message.
const char * fl_cancel = "Cancel"
 string pointer used in common dialogs, you can change it to a foreign language
const char * fl_close = "Close"
 string pointer used in common dialogs, you can change it to a foreign language
const char * fl_no = "No"
 string pointer used in common dialogs, you can change it to a foreign language
const char * fl_ok = "OK"
 string pointer used in common dialogs, you can change it to a foreign language
const char * fl_yes = "Yes"
 string pointer used in common dialogs, you can change it to a foreign language
static void(* Fl::warning )(const char *,...) = ::warning
 FLTK calls Fl::warning() to output a warning message.

Function Documentation

void fl_alert ( const char *  fmt,
  ... 
)

Shows an alert message dialog box.

Note:
Common dialog boxes are application modal. No more than one common dialog box can be open at any time. Requests for additional dialog boxes are ignored.

#include <FL/fl_ask.H>

Parameters:
[in] fmt can be used as an sprintf-like format and variables for the message text

int fl_ask ( const char *  fmt,
  ... 
)

Shows a dialog displaying the fmt message, this dialog features 2 yes/no buttons.

Note:
Common dialog boxes are application modal. No more than one common dialog box can be open at any time. Requests for additional dialog boxes are ignored.

#include <FL/fl_ask.H>

Parameters:
[in] fmt can be used as an sprintf-like format and variables for the message text
Return values:
0 if the no button is selected or another dialog box is still open
1 if yes is selected

void fl_beep ( int  type  ) 

Emits a system beep message.

Note:
#include <FL/fl_ask.H>

int fl_choice ( const char *  fmt,
const char *  b0,
const char *  b1,
const char *  b2,
  ... 
)

Shows a dialog displaying the fmt message, this dialog features up to 3 customizable choice buttons.

Note:
Common dialog boxes are application modal. No more than one common dialog box can be open at any time. Requests for additional dialog boxes are ignored.

#include <FL/fl_ask.H>

Parameters:
[in] fmt can be used as an sprintf-like format and variables for the message text
[in] b0 text label of button 0
[in] b1 text label of button 1
[in] b2 text label of button 2
Return values:
0 if the first button with b0 text is selected or another dialog box is still open
1 if the second button with b1 text is selected
2 if the third button with b2 text is selected

int fl_color_chooser ( const char *  name,
uchar r,
uchar g,
uchar b,
int  cmode 
) [related, inherited]

Pops up a window to let the user pick an arbitrary RGB color.

Note:
#include <FL/Fl_Color_Chooser.H>
fl_color_chooser.jpg
Parameters:
[in] name Title label for the window
[in,out] r,g,b Color components in the range 0 to 255.
[in] cmode Optional mode for color chooser. See mode(int). Default -1 if none (rgb mode).
Return values:
1 if user confirms the selection
0 if user cancels the dialog

int fl_color_chooser ( const char *  name,
double &  r,
double &  g,
double &  b,
int  cmode 
) [related, inherited]

Pops up a window to let the user pick an arbitrary RGB color.

Note:
#include <FL/Fl_Color_Chooser.H>
fl_color_chooser.jpg
Parameters:
[in] name Title label for the window
[in,out] r,g,b Color components in the range 0.0 to 1.0.
[in] cmode Optional mode for color chooser. See mode(int). Default -1 if none (rgb mode).
Return values:
1 if user confirms the selection
0 if user cancels the dialog

char * fl_dir_chooser ( const char *  message,
const char *  fname,
int  relative 
) [related, inherited]

Shows a file chooser dialog and gets a directory.

Note:
#include <FL/Fl_File_Chooser.H>
Parameters:
[in] message title bar text
[in] fname initial/default directory name
[in] relative 0 for absolute path return, relative otherwise
Returns:
the directory path string chosen by the user or NULL if user cancels

char * fl_file_chooser ( const char *  message,
const char *  pat,
const char *  fname,
int  relative 
) [related, inherited]

Shows a file chooser dialog and gets a filename.

Note:
#include <FL/Fl_File_Chooser.H>
Fl_File_Chooser.jpg
Parameters:
[in] message text in title bar
[in] pat filename pattern filter
[in] fname initial/default filename selection
[in] relative 0 for absolute path name, relative path name otherwise
Returns:
the user selected filename, in absolute or relative format or NULL if user cancels

void fl_file_chooser_callback ( void(*)(const char *)  cb  )  [related, inherited]

Set the file chooser callback

Note:
#include <FL/Fl_File_Chooser.H>

void fl_file_chooser_ok_label ( const char *  l  )  [related, inherited]

Set the "OK" button label

Note:
#include <FL/Fl_File_Chooser.H>

const char* fl_input ( const char *  fmt,
const char *  defstr,
  ... 
)

Shows an input dialog displaying the fmt message.

Note:
Common dialog boxes are application modal. No more than one common dialog box can be open at any time. Requests for additional dialog boxes are ignored.

#include <FL/fl_ask.H>

Parameters:
[in] fmt can be used as an sprintf-like format and variables for the message text
[in] defstr defines the default returned string if no text is entered
Returns:
the user string input if OK was pushed, NULL if Cancel was pushed or another dialog box was still open

void fl_message ( const char *  fmt,
  ... 
)

Shows an information message dialog box.

Note:
Common dialog boxes are application modal. No more than one common dialog box can be open at any time. Requests for additional dialog boxes are ignored.

#include <FL/fl_ask.H>

Parameters:
[in] fmt can be used as an sprintf-like format and variables for the message text

Fl_Widget* fl_message_icon (  ) 

Gets the Fl_Box icon container of the current default dialog used in many common dialogs like fl_message(), fl_alert(), fl_ask(), fl_choice(), fl_input(), fl_password().

Note:
#include <FL/fl_ask.H>

const char* fl_password ( const char *  fmt,
const char *  defstr,
  ... 
)

Shows an input dialog displaying the fmt message.

Like fl_input() except the input text is not shown, '*' characters are displayed instead.

Note:
Common dialog boxes are application modal. No more than one common dialog box can be open at any time. Requests for additional dialog boxes are ignored.

#include <FL/fl_ask.H>

Parameters:
[in] fmt can be used as an sprintf-like format and variables for the message text
[in] defstr defines the default returned string if no text is entered
Returns:
the user string input if OK was pushed, NULL if Cancel was pushed or aother dialog box was still open


Variable Documentation

void(* Fl::error)(const char *format,...) ( const char *  ,
  ... 
) = ::error [static, inherited]

FLTK calls Fl::error() to output a normal error message.

The default version on Windows displays the error message in a MessageBox window.

The default version on all other platforms prints the error message to stderr.

You can override the behavior by setting the function pointer to your own routine.

Fl::error() means there is a recoverable error such as the inability to read an image file. The default implementation returns after displaying the message.

Note:
#include <FL/Fl.H>

void(* Fl::fatal)(const char *format,...) ( const char *  ,
  ... 
) = ::fatal [static, inherited]

FLTK calls Fl::fatal() to output a fatal error message.

The default version on Windows displays the error message in a MessageBox window.

The default version on all other platforms prints the error message to stderr.

You can override the behavior by setting the function pointer to your own routine.

Fl::fatal() must not return, as FLTK is in an unusable state, however your version may be able to use longjmp or an exception to continue, as long as it does not call FLTK again. The default implementation exits with status 1 after displaying the message.

Note:
#include <FL/Fl.H>

void(* Fl::warning)(const char *format,...) ( const char *  ,
  ... 
) = ::warning [static, inherited]

FLTK calls Fl::warning() to output a warning message.

The default version on Windows returns without printing a warning message, because Windows programs normally don't have stderr (a console window) enabled.

The default version on all other platforms prints the warning message to stderr.

You can override the behavior by setting the function pointer to your own routine.

Fl::warning() means that there was a recoverable problem, the display may be messed up, but the user can probably keep working - all X protocol errors call this, for example. The default implementation returns after displaying the message.

Note:
#include <FL/Fl.H>


FLTK © 1998-2010 by Bill Spitzak and others.    Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.