Uwe Gansert > Paw-0.54 > Paw::Button

Download:
Paw-0.54.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Source  

Button Widget ^

$button=Paw::Button-new([$color], [$name], [\&callback], [$label]);>

Parameter

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

     name     => name of the button [optionally]

     callback => reference to the function which will be called
                 when pushing the button. [optionally]

     label    => text in the button. If the button contains text,
                 it is not possible to see if it is pushed or not.
                 [optionally]

Example

     $button=Paw::Button->new(callback=>\&button_callback);

Callback

     sub button_callback {
         my $this = shift;             # Referenz to the button
         
         $data = $edit->get_text();
         $box->add_row($data);
         return;
     }

set_button()

Sets the button into the status " pressed "

Example

     $button->set_button();      # [x]

release_button()

Sets the button into the status "not pressed"

Example

     $button->release_button();      # [ ]

push_button()

the button changes it status.

Example

     $button->push_button();      # [x]->[ ], [ ]->[x]

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

     $button->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)=$button->get_widget_pos();

set_color($color_pair)

Set a new color_pair for the widget.

Example

     $button->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();