• 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
Re: CFRunLoop usage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFRunLoop usage


  • Subject: Re: CFRunLoop usage
  • From: Izidor Jerebic <email@hidden>
  • Date: Wed, 8 Oct 2003 19:55:39 +0200

Well, this is starting to be interesting. Normal windows are modeless, and default run loop is sufficient to handle events, because events need to go to different windows, based on their click position and main/key window status for keyboard events. So, for modeless windows, you do not need any special runloops.

The description "window which consumes all events and blocks application until it is finished" is a modal window. It cannot be modeless window, unless you have different understanding of the word modeless. For modeless window you can use normal cocoa window and default run loop, because events will be sent to different windows correctly.

Using nextEventMatchingMask is just your code implementing runModalForWindow, because the effect will be the same. This method is used typically for part-time local modal loops such as collecting events while dragging the mouse and drawing the line according to mouse position until mouse up event, but not for running the whole window. Running the whole window is the purpose of the runModalForWindow method.

Or is there something I do not understand? What exactly do you want to achieve?

izidor


On Wednesday, Oct 8, 2003, at 17:42 Europe/Ljubljana, Ron Anderson wrote:

Izidor,

Thanks for replying. For an Application Modal window, I do use the
runModalForWindow method, but I am creating a modeless window. It seems
that what I need to do is run a nextEventMatchingMask/sendEvent loop
on the window, instead of a runloop. I am also aware that what I am
trying to do is not ideal or, in fact, a proper implementation.

Ron

Izidor Jerebic wrote on 10/8/03, 4:10 AM:


On Tuesday, Oct 7, 2003, at 22:00 Europe/Ljubljana, Ron Anderson wrote:


Basically, I need to dispatch a window (in Cocoa) and then run a local
event loop to handle events for the window (to support a synchronous
call
without additional thread) and when the window is completed, continue
on.


Why don't you use [[NSApplication sharedApplication]
runModalForWindow:aWindow] method? This does exactly what you
described...

izidor
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: CFRunLoop usage
      • From: "Alastair J.Houghton" <email@hidden>
  • Prev by Date: Re: Responder problem [flagsChanged cmd keyUp solved]
  • Next by Date: Re: launching 2 same applications
  • Previous by thread: Re: CFRunLoop usage
  • Next by thread: Re: CFRunLoop usage
  • Index(es):
    • Date
    • Thread