🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.unix.programmer
1 messages
1 total messages Started by Tony Rems Mon, 03 Dec 1990 12:02
Re: curses fcn. key problem...
#1317
Author: Tony Rems
Date: Mon, 03 Dec 1990 12:02
69 lines
2061 bytes
Sender: 
Reply-To: rembo@unisoft.UUCP (Tony Rems)
Followup-To: 
Distribution: 
Organization: UniSoft Corporation -- UNIX R Us.
Keywords: 

I saved this off and couldn't get the e-mail address path to go
through.  So, this is in response to Doug Bender's curses question:

>for opening sub_windows etc. I've read our manuals on curses, and
>they explain everything but interpreting function keys. Here is a
>rough example of my program;
>
>   main()
>   {

Well, first of all the slk_init() routine takes an argument, so
your fcn. keys may not be getting initialized correctly.  The 
argument is the format (an int) that you are going to use for
your fcn. keys.
>	  slk_init();
>	  initscr();
>	  slk_set(1,"Menu",1);
>	  slk_set(2,"Help",1);
>	  keypad(stdscr,TRUE);
>	  help=subwin(stdscr,15,60,5,10);
>	  menu=subwin(stdscr,20,20,2,30);
>
>	  cbreak();
>	  draw_screen();
>	  check_fkey();
>	  .
>	  .
>	  .
>	  endwin();
>  }
>  int check_fkey()
>  {
>	  int fkey;
>	  fkey=mvwgetch(stdscr,1,1);
>	  switch(fkey)
>	  {
>	  case KEY_F(1):
>		  menu_screen();
>		  break;
>	  case KEY_F(2):
>		  help_screen();
>		  break;
>	  default:

Second:
	You have the arguments here wrong.  You don't want the
	stdscr in here.  This should just be: mvaddstr(1,1,"Key unrecognized");
>		  mvaddstr(stdscr,1,1," Key unrecognized");
>		  break;
>	  }
>	  wrefresh(stdscr);
>  }
>

Besides that, you're on the right track.  I made the corrections and
compiled your program (I had to stub the missing routines), and it
ran fine (I love when that happens :-) ).  

If this doesn't fix your problem send me some mail with the problems
to rembo@unisoft.com.

-Tony
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads