The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

FLTK::ask - Implementation of message, ask, choice, and input functions

Description

Implementation of FLTK::message(), FLTK::ask(...), FLTK::choice(...), FLTK::input().

Functions

BEEP_DEFAULT

BEEP_DEFAULT( );

Import this function with the :dialog tag.

BEEP_ERROR

BEEP_ERROR( );

Import this function with the :dialog tag.

BEEP_MESSAGE

BEEP_MESSAGE( );

Import this function with the :dialog tag.

BEEP_NOTIFICATION

BEEP_NOTIFICATION( );

Import this function with the :dialog tag.

BEEP_PASSWORD

BEEP_PASSWORD( );

Import this function with the :dialog tag.

BEEP_QUESTION

BEEP_QUESTION( );

Import this function with the :dialog tag.

alert

FLTK::alert( $string );

Same as FLTK::message() except for the "!" symbol.

Import this function with the :dialog or :default tags.

ask

my $choice = FLTK::ask( $question );

Displays a message in a pop-up box with a "Yes" and "No" button and waits for the user to hit a button. The return value is 1 if the user hits "Yes", 0 if they pick "No". The Enter key is a shortcut for "Yes" and ESC is a shortcut for "No".

If message_window_timeout is used, then -1 will be returned if the timeout expires.

Import this function with the :dialog tag.

beep

FLTK::beep( $type );

Generates a simple beep message.

Import this function with the :dialog or :default tags.

beep_on_dialog

FLTK::beep_on_dialog( $value );

You can enable beep on default message dialog (like ask, choice, input, ...) by using this function with true (default is false).

Import this function with the :dialog tag.

my $value = FLTK::beep_on_dialog( );

You get the state enable beep on default message dialog (like ask, choice, input, ...) by using this function with true (default is false).

Import this function with the :dialog tag.

choice

my $choice = FLTK::choice( $question, $answer_1, $answer_2, $answer_3 );

Shows the message with three buttons below it marked with the strings answer_1, answer_2, and answer_3. Returns 0, 1, or 2 depending on which button is hit. If one of the strings begins with the special character '*' then the associated button will be the default which is selected when the Enter key is pressed. ESC is a shortcut for answer_1.

If message_window_timeout is used, then -1 will be returned if the timeout expires.

Import this function with the :dialog or :default tags.

choice_alert

my $choice = FLTK::choice_alert( $question, $question, $answer_1, $answer_2, $answer_3 );

Same as choice() except a "!" icon is used instead of a "?"

Import this function with the :dialog or :default tags.

icon_style

my $style = FLTK::icon_style( );

This Style is used for the 50x50 icon area on the left of all the popup windows. You can change the colors or font used here.

Import this function with the :dialog tag.

FLTK::icon_style( $style );

Set the icon style.

Import this function with the :dialog tag.

input

my $string = FLTK::input( $label, $default_value );

Pops up a window displaying a string, lets the user edit it, and return the new value. The cancel button returns undef. The returned pointer is only valid until the next time FLTK::input() is called.

If message_window_timeout is used, then 0 will be returned if the timeout expires.

Import this function with the :dialog or :default tags.

message

FLTK::message( $string );

Displays a message in a pop-up box with an "OK" button, waits for the user to hit the button. The message will wrap to fit the window, or may be many lines by putting \n characters into it. The enter key is a shortcut for the OK button.

Import this function with the :dialog or :default tags.

message_style

my $style = FLTK::message_style( );

This Style is used for the label area for all the popup windows. You can change the textfont() or textsize() to make them print differently.

Import this function with the :dialog tag.

FLTK::message_style( $style );

Set the message style.

Import this function with the :dialog tag.

password

my $string = FLTK::password( $label, $default_value );

Same as FLTK::input() except an FLTK::SecretInput field is used.

Import this function with the :dialog or :default tags.

Variables

There are a few variables you my change that affect how FLTK behaves.

  • $FLTK::message_window_label

    The value of this is used as the title of message(), alert(), ask(), choice(), etc. windows.

  • $FLTK::no

    You can change this string to convert FLTK to a foreign language.

  • $FLTK::yes

    You can change this string to convert FLTK to a foreign language.

  • $FLTK::ok

    You can change this string to convert FLTK to a foreign language.

  • $FLTK::cancel

    You can change this string to convert FLTK to a foreign language.

  • $FLTK::message_window_timeout

    Set this to a positive value to cause the message(), alert(), ask(), choice(), etc. windows to close automatically after this timeout. If the timeout expires, -1 will be returned by the functions that return integers. The timeout value is a float in seconds.

  • $FLTK::message_window_scrollable

    When this is set to true, then (all) message windows will use scrollbars if the given message is too long.

Author

Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/

License and Legal

Copyright (C) 2008-2010 by Sanko Robinson <sanko@cpan.org>

This program is free software; you can redistribute it and/or modify it under the terms of The Artistic License 2.0. See the LICENSE file included with this distribution or notes on the Artistic License 2.0 for clarification.

When separated from the distribution, all original POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See the clarification of the CCA-SA3.0.