🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.programmer
2 messages
2 total messages Started by Dennis Box Mon, 27 Jul 1992 22:06
(probably) newbie question about keyboard intercepts
#273
Author: Dennis Box
Date: Mon, 27 Jul 1992 22:06
25 lines
1434 bytes
Hello all,

I have a NextStep application that occasionally goes into a (long) loop
when a user asks the wrong query of its database. I have been asked
to change this behaviour so that a control-c ejects the program from the
loop, returning control to the main event loop.

My question is, where do keyboard interrupts go, and how does a programmer
detect and use them?  The unix <signal.h> stuff doesn't work, NextStep or
Mach or something obviously grabs signals uses them to its own ends.

Is there a function in NextStep that is as conceptually easy as the 
signal.h stuff ?  Better yet, which appkit object contains the
[actNormallyUntillAControlcIsPressedThenSendMessageTo:myObject] method?
Can I easily roll my own such method?


Thanks in advance,


--
Dennis D. Box          	|   (312) 732-6329 	| "Its FUN to have fun,
My own opinions, not 	| dennis@fnbc.com      	| but you have to know 
my employers. Your 	| ddb@vpnet.chi.il.us	| how!"   -T. Geisel
reactions may vary. 	|  Kill Your Television.  
Re: (probably) newbie question about keyboard intercepts
#306
Author: moose
Date: Tue, 28 Jul 1992 16:49
23 lines
1448 bytes
In article <1992Jul27.220624.1369@fnbc.com> dennis@fnbc.com (Dennis Box )  
writes:
> Hello all,
> 
> I have a NextStep application that occasionally goes into a (long) loop
> when a user asks the wrong query of its database. I have been asked
> to change this behaviour so that a control-c ejects the program from the
> loop, returning control to the main event loop.
> 
> My question is, where do keyboard interrupts go, and how does a programmer
> detect and use them?  The unix <signal.h> stuff doesn't work, NextStep or
> Mach or something obviously grabs signals uses them to its own ends.

You can get the next key event with a getNextEvent: method in Application, or  
you can directly querry them using the evs stuff (look in the man pages).

However, NeXT recommends you use the NXUserAborted() function to detect the  
user hitting cmd-.
--
Michael Rutman			|	moose@svcdudes.com
Cubist				|	makes me a NeXT programmer
Software Ventures		|	maker of MicroPhone II
#include <std.disclaimer>
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