#!/usr/local/bin/curseperl
#**************************************************************************
# demo_getstr --  Simple perl menu demo
#
# Notes:   Requires curseperl.
#          Demonstrates "menu_getstr" utility routine (useful in curseperl
#          programs.
#
# Author:  Steven L. Kunz
#          Networking & Communications
#          Iowa State University Computation Center
#          Ames, IA  50011
#          Email: skunz@iastate.edu
#
# Date:    September, 1993
#**************************************************************************

require "./menu.pl";

# Init the menu package (even though we are not using any menus).
# This is needed to load the terminal key definitions.
&menu_init;

# Put out a title and instructions.
&clear;
&move(0,25);
&addstr("Perlmenu 2.1 - menu_getstr Demonstration");
&move(2,5);
&addstr("Enter strings, using left and right arrows to move insert/deletion");
&move(3,5);
&addstr("point after you have entered some characters.");
&move(4,5);
&addstr("Null entry exits.");

while (1) {
  $string = &menu_getstr(10,5,"Enter value: ",0); # Get a string
  if ($string eq "") { # Exit if we get a null string
    &clear;
    &refresh;
    last;
  }
  &move(12,5); # Display last string entered
  &clrtobot;
  &addstr("Last string entered: $string");
  &refresh;
}

&endwin;
