The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Radiobutton Widget

$rb=Paw::Radiobutton-new(\@labels, [$direction], [$color], [$name], [\&callback]);>

Parameter

     \@labels   => array of label for the buttons,
                   one element for each button.

     $color     => The colorpair must be generated with
                   Curses::init_pair(pair_nr, COLOR_fg, COLOR_bg)
                   [optionally]

     $name      => name of the widget [optionally]

     \&callback => reference to a function which will be executed
                   if the radiobutton is being pressed. [optional]

     $direction => "h"orizontally or "v"ertically (default) [optionally]

Example

     @labels=("Red", "Green", "Blue");
     $rb=Paw::Radiobutton->new(labels=>\@labels, direction=>"v");

Callback

Similarly as with the normal button.

set_button()

the aktive button will be set/pushed.

Example

     $rb->set_button();

get_pressed()

returns the number of the pressed button. (starting at 0).

Example

     $pushed_button=$rb->get_pressed();

abs_move_widget($new_x, $new_y)

the widget moves to the new absolute screen position. if you set only one of the two parameters, the other one keeps the old value.

Example

     $rb->abs_move_widget( new_x=>5 );      #y-pos is the same

get_widget_pos()

returns an array of two values, the x-position and the y-position of the widget.

Example

     ($xpos,$ypos)=$rb->get_widget_pos();

set_color($color_pair)

Set a new color_pair for the widget.

Example

     $box->set_color(3);

set_border(["shade"])

activates the border of the widget (optionally also with shadows).

Example

     $widget->set_border("shade"); or $widget->set_border();