Functions - siffiejoe/lua-fltk4lua GitHub Wiki
Additional module functions:
fl.run() ==> int exit_status( 0 on successful exit )
( supposedly non-zero on errors, but FLTK calls exit directly instead )fl.wait( *int seconds ) ==> bool visible_windowsfl.check() ==> bool visible_windowssame as fl.wait(0) calling during a big calculation will keep screen updated
fl.args( table )parse command line switches
fl.get_system_colors()read user preference colors from system and use them
to call Fl::foreground(), Fl::background(), and Fl::background2()fl.scheme() ==> *str modegetfl.scheme( *str mode )set
select mode:"none"default, resembles Win (95/98/Me/NT/2000) and old GTK/KDE"base"same as "none""plastic"inspired by Aqua on Mac OS X"gtk+"inspired by Red Hat Bluecurve theme"gleam"inspired by Clearlooks Glossy scheme
fl.redraw()redraw all widgets
fl.option( str which_option ) ==> bool enabledget Fl_Optionfl.option( str which_option, bool enabled )set"OPTION_ARROW_FOCUS""OPTION_VISIBLE_FOCUS""OPTION_DND_TEXT""OPTION_SHOW_TOOLTIPS""OPTION_FNFC_USES_GTK""OPTION_LAST"
fl.open_uri( str uri ) ==> bool successopens specified Uniform Resource Identifier (URI)
fl.inactive( int|userdata image ) ==> userdata greyed_imageproduce copy of image that appears grayed out
fl.contrast( int|userdata fg_color, int|userdata bg_color ) ==> userdata colorreturns Fl_Color that contrasts with background.
fg_color if sufficient contrast,
otherwise, FL_WHITE or FL_BLACK depending on best contrastfl.color_average( int|userdata color, int|userdata color ) ==> userdata colorfl.lighter( int|userdata color ) ==> userdata colorreturn lighter version of specified color
fl.darker( int|userdata color ) == userdata colorreturn darker version of specified color
fl.rgb_color( int grey ) ==> userdata colorreturns 24-bit greyscale value closest to g, g, g
fl.rgb_color( int red, int green, int blue ) ==> userdata colorreturns 24-bit color value closest to r, g, b
fl.get_color( int|userdata color ) ==> int red, int green, int bluefl.set_color( int|userdata color, int red, int green, int blue )Sets an entry in fl_color index table
fl.cursor( str cursor, int|userdata color, int|userdata color )"FL_CURSOR_DEFAULT""FL_CURSOR_ARROW""FL_CURSOR_CROSS""FL_CURSOR_WAIT""FL_CURSOR_INSERT""FL_CURSOR_HAND""FL_CURSOR_HELP""FL_CURSOR_MOVE""FL_CURSOR_NS""FL_CURSOR_WE""FL_CURSOR_NWSE""FL_CURSOR_NESW""FL_CURSOR_N""FL_CURSOR_NE""FL_CURSOR_E""FL_CURSOR_SE""FL_CURSOR_S""FL_CURSOR_SW""FL_CURSOR_W""FL_CURSOR_NW""FL_CURSOR_NONE"
fl.shortcut_label( int|str|userdata shortcut ) ==> str human-readablehuman-readable string from a keyboard shortcut
fl.alert( str message )shows an alert message dialog box
fl.beep( *str mode )"FL_BEEP_DEFAULT""FL_BEEP_MESSAGE""FL_BEEP_ERROR""FL_BEEP_QUESTION""FL_BEEP_PASSWORD""FL_BEEP_NOTIFICATION"
fl.choice( str message, *str button_0, *str button_1, *str button_2 ) ==> *str selecteddialog w/ printf style message
up to 3 customizable buttonsfl.color_chooser( *str name, *int red, *int green, *int blue, *int mode ) ==> *userdata colorselect mode:
0rgb1byte2hex3hsv
fl.dir_chooser( str title, str dirname, bool relative_path ) == *str dir0 for absolute path return, otherwise relative
fl.file_chooser( str title, str pattern_filter, str filename, bool relative_path ) == *str filefl.input( str formatted_msg, *str default ) ==> *str textstandard sprintf formatting
fl.message( str formatted_msg )shows an info box, standard sprintf formatting
fl.password( str formatted_msg, *str default ) ==> *str pswdstandard sprintf formatting
fl.message_hotspot() ==> bool follow_mousegetfl.message_hotspot( bool follow_mouse )set
when true, messages pop up where the mouse isfl.add_fd( int descriptor, callback function, *userdata )Adds file descriptor to listen to
then calls specified callback functionfl.remove_fd( int descriptor, *userdata when )removes file descriptor handler