IupFontDlg

IUP - Portable User Interface

IupFontDlg (Windows and GTK only) (since 3.0)

Creates the Font Dialog element. It is a predefined dialog for selecting a font. The dialog can be shown with the IupPopup function only.

Creation

Ihandle* IupFontDlg(void); [in C]
iup.fontdlg() -> (elem: ihandle) [in Lua]
fontdlg() [in LED]

Returns: the identifier of the created element, or NULL if an error occurs.

Attributes

PREVIEWTEXT (GTK only): the text shown in the preview area. If not defined GTK will provide a default text.

COLOR (Windows Only) (in/out): The initial color value and the returned selected value if the user pressed the Ok button. In Windows the Choose Font dialog allows hte user to select a color from a pre-defined list of colors.

PARENTDIALOG: (Creation Only) Name of a dialog to be used as parent. This dialog will be always in front of the parent dialog.

STATUS (out): defined to "1" if the user pressed the Ok button, NULL if pressed the Cancel button.

TITLE: Dialog title.

VALUE (in/out): The initial font value and the returned selected value if the user pressed the Ok button. Has the same format of the FONT attribute.

Callbacks

HELP_CB: Action generated when the Help button is pressed.

Notes

The IupFontDlg is a native pre-defined dialog not altered by IupSetLanguage.

To show the dialog, use function IupPopup. In Lua, use the popup function.

The dialog is mapped only inside IupPopup, IupMap does nothing.

Examples

Ihandle* dlg = IupFontDlg();

IupSetAttribute(dlg, "COLOR", "128 0 255");
IupSetAttribute(dlg, "VALUE", "Times New Roman, Bold 20");
IupSetAttribute(dlg, "TITLE", "IupFontDlg Test");
IupSetCallback(dlg, "HELP_CB", (Icallback)help_cb);

IupPopup(dlg, IUP_CURRENT, IUP_CURRENT);

if (IupGetInt(dlg, "STATUS"))
{
  printf("OK\n");
  printf("  VALUE(%s)\n", IupGetAttribute(dlg, "VALUE"));
  printf("  COLOR(%s)\n", IupGetAttribute(dlg, "COLOR"));
}
else
  printf("CANCEL\n");

IupDestroy(dlg); 
Windows XP GTK/GNOME

See Also

IupMessageDlg, IupFileDlg, IupPopup