Lee ♫ Goddard > Tk-Wizard-2.151 > Tk::Wizard::Choices

Download:
Tk-Wizard-2.151.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  3
View/Report Bugs
Module Version: 2.077   Source  

NAME ^

Tk::Wizard::Choices - Tk::Wizard pages to collect end-user choices

SYNOPSIS ^

Currently automatically loaded by Tk::Wizard, though this behaviour is deprecated and is expected to change in 2008.

DESCRIPTION ^

Adds a number of methods to Tk::Wizard, to collect choices made by the end-user.

METHODS ^

addMultipleChoicePage

Allow the user to make multiple choices among several options: each choice sets a variable passed as reference to this method.

Accepts the usual parameters plus:

-relief

For the checkbox buttons - see Tk::options.

-choices

A reference to an array of hashes with the following fields:

-title

Title of the option, will be rendered in bold

-subtitle

Text rendered smaller beneath the title

-variable

Reference to a variable that will contain the result of the choice. Croaks if none supplied. Your -variable will contain the default Tk::Checkbutton values of 1 for checked and 0 for unchecked.

-checked

Pass a true value to specify that the box should initially appear checked.

Here is an example of what the -choices parameter should look like:

  $wizard->addMultipleChoicePage(
    -title => "Another toy example",
    -choices =>
      [
        {
         -title => 'choice 1',
         -variable => \$choice1,
        },
        {
         -title => 'choice 2, default is checked',
         -variable => \$choice2,
         -checked => 1,
        },
      ],
    );

addSingleChoicePage

Allow the user to make one choice from among several options (i.e. a group of radio buttons). Each choice sets a variable passed as reference to this method.

Accepts the usual parameters plus:

-relief

For the radio buttons - see Tk::options.

-variable

Reference to a variable that will contain the result of the choice. Croaks if none supplied. Your -variable will contain the -value of the radio button that is selected when the user clicks "Next".

-choices

A reference to an array of hashes with the following fields:

-title

Title of the option, will be rendered in bold

-subtitle

Text rendered smaller beneath the title

-value

This value will be placed in your -variable variable if this button is selected

-selected

Pass a true value to specify that this radio should initially appear selected. If none of the choices have -selected, then the first choice will be selected by default.

Here is an example of what the -choices parameter should look like:

  $wizard->addSingleChoicePage(
    -title => 'Another toy example',
    -text => 'Choose one of the following:',
    -variable => \$choice,
    -choices =>
      [
        {
         -title => 'choice 1',
         -value => 1,
        },
        {
         -title => 'choice two, default this one selected',
         -value => 'two',
         -selected => 1,
        },
      ],
    );

AUTHOR ^

Lee Goddard (lgoddard@cpan.org).

COPYRIGHT ^

Copyright (C) Lee Goddard, 11/2002 - 01/2008 ff.

Made available under the same terms as Perl itself.

syntax highlighting: