is there any small lib thar can process key combination on terminal
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > is there any small lib thar can process key combination on terminal




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    is there any small lib thar can process key combination on terminal  
Key9


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-16-06 06:43 PM

Hi all

I am trying to write some console app
but I found that ncurses/SLang is too big for me,

also it still need to wrote code to process key combination something like
CTRL+ALT+P

What I need is a directly responsed getch();
and a defined keymap.

Is there any sample or issue of that?


thank you very much
your key9







[ Post a follow-up to this message ]



    Re: is there any small lib thar can process key combination on terminal  
key9


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-16-06 06:43 PM

PS also because <alt><shift>... not send the signal when using vty100 £¬ the
work becoming hard.







[ Post a follow-up to this message ]



    Re: is there any small lib thar can process key combination on terminal  
zentara


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-16-06 06:43 PM

On Thu, 14 Sep 2006 03:17:24 +0800, "Key9" <publicaccept@163.com> wrote:

>Hi all
>
>I am trying to write some console app
>but I found that ncurses/SLang is too big for me,
>
>also it still need to wrote code to process key combination something like
>CTRL+ALT+P
>
>What I need is a directly responsed getch();
>and a defined keymap.
>
>Is there any sample or issue of that?
>
>
>                                thank you very much
>                                          your key9

Check out Perl's Term::ReadKey.
Search Google and groups.google for more
complex examples.

#!/usr/bin/perl
use warnings;
use strict;
use Term::ReadKey;

#passing ReadKey() an argument of -1 to indicate not to block:

ReadMode('cbreak');

while(1){
my $char;
if (defined ($char = ReadKey(0)) ) {
print "$char->", ord($char),"\n";    # input was waiting and it
was $char
if(ord($char) == 144){ print "Got a Ctrl-Alt-p\n"  }

} else {
# no input was waiting
# do whatever
}
}


ReadMode('normal');                  # restore normal tty settings
__END__



--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 04:22 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register