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

Textentry Widget

$te=Paw::Text_entry-new($width, [$cursor_color], [$color], [$name], [\&callback], [$text], [$side], [$echo], [$max_length] );>

Parameter

     width        => width of the text-entry (in other words: columns)

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

     cursor_color => same like color but only for the cursor

     name         => name of the widget [optionally]

     callback     => reference to the function that will be
                   executed each time you press a key in the entry.
                   [optionally]

     text         => default text for the entry [optionally]

     orientation  => "left"(default) or "right"
                   for left/right-justified text.

     echo         => 0, 1  oder 2 : 0=no echo of the entered text,
                   1=Stars instead of characters, 2=full echo (default)
                   (0 and 1 good for passwords) [optional]

     max_length   => maximum length of the entry (default = 1024)

Example

     $te=Paw::Text_entry->new(width=>15, text=>"PLEASE ENTER NAME",
                                  max_length=>25); 

Callback

The callback function will be started each time you press a key in the text-entry. The object reference ($this) and the key value will be given to the callback. This will give you the chance to allow only digits or whatever you want. You must return the key-value or no text will ever reach into the widget.

sub callback { my $this = shift; my $key = shift;

   [... do some stuff ...]

   return $key;
}

get_text()

returns the text of the entry.

Example

     $text=$te->get_text();

set_text($text)

set the text in the entry to $text.

Example

     $te->set_text("default");

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

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