LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-18-2006, 07:25 AM   #1
mayank_linux
LQ Newbie
 
Registered: Jun 2006
Posts: 18

Rep: Reputation: 0
NCURSES keypad


hi

Please tell me that in NCURSES when i use function
keypad(), i can use KEY_UP,KEY_DOWN,KEYF0..and so on.

values of these macros are there in ncurses.h.

now my problem is that, when i press a key and match corresponding ascii value from ncurses.h, it does not match.
for eg. KEY_UP has the value 403 in ncurses.h
but i get the value 259
similarly KEY_DOWN has the value 402 in ncurses.h
but i get the value 258..

i dont understand the matter

all suggestions are welcome
 
Old 10-21-2006, 04:50 AM   #2
achu
LQ Newbie
 
Registered: Oct 2006
Location: Poland
Posts: 5

Rep: Reputation: 0
In ncurses.h I have something like that:
Code:
#define KEY_UP       0403
0403 is an octal number, not decimal (you have 0 before the number). So octal 403 is decimal 259 (4*8^2+3).

Last edited by achu; 10-21-2006 at 04:53 AM.
 
Old 10-21-2006, 08:07 PM   #3
_john_i_
Member
 
Registered: Aug 2003
Location: Austin, TX
Distribution: Linux from Scratch
Posts: 52

Rep: Reputation: 15
Normally you shouldn't worry about the numeric value of the keystroke. If you need to check for it check for key == KEY_UP, not key == 259
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
keypad operation carthyc Linux - General 1 06-29-2005 06:49 AM
Numerical keypad Craqon Linux - General 2 12-15-2004 12:42 AM
ncurses window and keypad vegpl Programming 2 11-01-2004 02:00 AM
Keypad problems vexer Linux - Hardware 1 06-17-2003 09:35 PM
ncurses-5.2-28 conflicts with file from package ncurses-5.2-12 tubby Linux - Software 4 06-16-2002 12:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration