• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
First questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: First questions
      • From: Brendan Younger <email@hidden>
  • Prev by Date: help with FSPathMakeRef
  • Next by Date: Re: Preferences using NSUserDefaults (newbie)
  • Previous by thread: Re: help with FSPathMakeRef
  • Next by thread: Re: First questions
  • Index(es):
    • Date
    • Thread