* ts (decoux / moulon.inra.fr) [010412 19:42]: > >>>>> "M" == Matthew PATTISON <mfp / students.cs.mu.OZ.AU> writes: > > M> to catch characters as they're entered, then I have a case statement > M> where I execute a different piece of code based on what the character > M> is. My problem is, how do I detect the Esc. key or arrow keys or other > M> special keys? > > Well some interfaces (all ???) to curses has a function keypad() to return > function key but I've not seen an interface to this function in curses.c > > What you can do when you receive Esc (i.e. 0033) is to use IO::select > (with 0 as timeout) to see if some characters are pending, read these > characters and decode these characters as an arrow, or special keys. Thanks, I can now catch Esc being pressed, but I'm not sure how to use IO::select. The Pickaxe book doesn't go into a lot of detail. What would be the readArray in this instance, (I'm lookiing at p332 & p426 of Programming Ruby) and what exactly is returned from the function call, and how do I extract from it what character has been pressed? Also, before, for instance, when I typed in an up arrow, ^[[A came up on the screen. Now that I am catching Esc, [A comes up. How can I get it so that nothing shows up on the screen. > Guy Decoux > Sorry for all the questions, Matt