Hi,

Firstly, thanks to everyone on the list for getting me this far.

I'm looking for a bit of advice.

I've got a script running which presents VT220 Clients (handheld devices
with barcode readers, 802.11 radios, 12x20 LCD Display running DOS, an IP
Stack and a VT220 Client) with menus allowing them to do a stocktake by
scanning items barcodes and entering the number of items.

We service a lot of electronic equipment, the plan is to use this to speed
up stocktakes in our 'spare parts' stores.

The menuing system is very messy - I'm just doing a print $remote
"blah\r\nblah";
Also, I'm waiting for a CR before reading the user input, so for a menu
saying for example 'F3 - Exit' - a user has to type 'F3' followed by the
'ENTER' key.

I've taken a look at the curses module and it looks like it would do what I
need to do but unfortunately I've got to stick to a Win32 platform as the
script will generally be run on PC's running Win98/2K/XP.

Any suggestions on a better way to do what I'm doing (or any other
programmatic faux pas) are very welcome.

sub writeDisplay {
                
                my ($itemNo, $desc, $modDate, $number, $inputRequest) = @_;

                print $remote("\e[2J");         #Clear the Display

                print $remote ("\e[0;0H");      #Return Cursor Position to
Line 0 Col 0            

                print $remote(
                "    LXE STOCKTAKE\r\n",
                "ITEM: ",
                "$itemNo\r\n",
                "DESC: ",
                "$desc\r\n",
                "DATE: ",
                "$modDate\r\n",
                "STCK: ",
                "$number\r\n",
                "\r\n",
                "Enter $inputRequest\r\n");
                print $remote ("\e[9;1H");      #Set Cursor Position to Line
8 Col 1
                print $remote ("    (F3) EXIT");
                #print $remote ("\e[2K");
                print $remote ("\e[8;0H");      #Return Cursor Position to
Line 7 Col 0

                }

sub readInput   {
                if ($debug == 1) {print("DEBUG-readInput\r\n");}
                my $numOrAlpha = shift;
                my $userInput = undef;          
                                        
                if ($numOrAlpha eq "num") 
                        {
                        while (($userInput =~ m/\D/) || (!
length($userInput))) #Expecting Numeric Input from User
                                {
                                $userInput = <$remote>;
                                chomp($userInput);
                                if (($userInput =~ m/\D/) || (!
length($userInput))) {onError("invalid number");}
                                }                               }
                        }
                else
                        {
                        while  (! length($userInput))           #Expecting
Alphanumeric Input from User
                                {
                                $userInput = <$remote>;
                                chomp($userInput);
                                if (! length($userInput)) {onError("Enter
Part No.");}
                                }
                        }

                $input = $userInput;
                return($input);          
                }       



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to