First questions
First questions
- Subject: First questions
- From: Ian Lynch Smith <email@hidden>
- Date: Thu, 21 Jun 2001 17:36:38 -0400
Hi all,
I've got a question about event handling. In my code, I've got a
while(1) loop in which I process events, respond to them, and draw stuff
in OpenGL. However, I intercept all events and none get through to the
window--it cannot be selected, minimized, etc...What is the way around
this? The answer probably lies in the NSEvent and NSApplication classes
but I haven't been able to figure it out.
Also, with mouse events, the points of clicks that I get do not adjust
if the window has been moved. In other words, clicking on the bottom
left coordinates of the window after it has been moved does not register
(0,0).
Here's the code I used:
NSEventType type;
pool = [[NSAutoreleasePool alloc] init];
event = [NSApp nextEventMatchingMask:NSAnyEventMask
untilDate:distantPast inMode:NSDefaultRunLoopMode dequeue:YES];
type = [event type];
switch (type) {
//handles the cases...
And to get the coordinates of the point in the window and in relative
OpenGL view:
mypoint = [event locationInWindow];
mypoint = [myGL convertPoint: mypoint fromView: nil];
x = mypoint.x;
y = mypoint.y;
thanks for the help,
email@hidden