Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 20 Oct 2014, 04:10
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Function keys and rxvt term with ncurses/curses
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [1 Post]  
Author Message
wibble


Joined: 10 Jul 2013
Posts: 77

PostPosted: Sat 22 Feb 2014, 11:46    Post subject:  Function keys and rxvt term with ncurses/curses
Subject description: Not functioning...
 

So I am trying to cobble togeather my menu system and I figured - ncurses/curses can do everything I want (and more).

But I cannot get the function keys to respond.

Code:

#include <ncurses.h>

int main()
{   int ch;

   initscr();         /* Start curses mode       */
   raw();            /* Line buffering disabled   */
   keypad(stdscr, TRUE);      /* We get F1, F2 etc..      */
   noecho();         /* Don't echo() while we do getch */

       printw("Type any character to see it in bold\n");
   ch = getch();         /* If raw() hadn't been called
                * we have to press enter before it
                * gets to the program       */
   if(ch == KEY_F(1))      /* Without keypad enabled this will */
      printw("F1 Key pressed");/*  not get to us either   */
               /* Without noecho() some ugly escape
                * charachters might have been printed
                * on screen         */
   else
   {   printw("The pressed key is ");
      attron(A_BOLD);
      printw("%c", ch);
      attroff(A_BOLD);
   }
   refresh();         /* Print it on to the real screen */
       getch();         /* Wait for user input */
   endwin();         /* End curses mode        */

   return 0;
}


What I don't understand is

keypad(stdscr, TRUE);

should enable the reading of function keys but its not working...

any ideas? Confused
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [1 Post]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0398s ][ Queries: 12 (0.0042s) ][ GZIP on ]