• 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
Drawing while handling events (was Re: scribbling)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Drawing while handling events (was Re: scribbling)


  • Subject: Drawing while handling events (was Re: scribbling)
  • From: Fritz Anderson <email@hidden>
  • Date: Wed, 13 Aug 2003 14:32:08 -0500

On Wednesday, 13 August 2003, at 1:56 PM, John Randolph wrote:

First suggestion: don't do any drawing in an event-handling method, and don't call -lockFocus yourself. Just update the info you need to do the drawing, and call -setNeedsDisplayInRect:.

May I ask you to explore this more closely? This seems to contradict the example in the tasks-and-concepts documentation for mouse-event handling in NSViews, "Handling Mouse Events in Views," <file:///Developer/Documentation/Cocoa/TasksAndConcepts/ ProgrammingTopics/BasicEventHandling/Tasks/HandlingMouseEvents.html>

The document says, "NSViews that handle mouse clicks as a single event, from mouse down, through dragging, to mouse up, must usually short-circuit the applications normal event loop, entering a modal event loop to catch and process only events of interest." It then provides an example of a mouseDown: handler implementing a loop on -[NSWindow nextEventMatchingMask:], which calls drawing methods. I could see how the equivalent program mode could be handled by state-sensitive mouseUp: and mouseDragged: methods, but it would be a lot uglier.

Are you disagreeing, or are you saying it's OK to draw in that case where the state from mouse-down to mouse-up amounts to a unique, modal event? But if the latter is the case, why isn't "scribbling" with the mouse the same sort of state?

I'm not arguing; I want to learn.

-- F
_______________________________________________
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: Drawing while handling events (was Re: scribbling)
      • From: John Randolph <email@hidden>
References: 
 >Re: scribbling (From: Richard Chamberlain <email@hidden>)
 >Re: scribbling (From: John Randolph <email@hidden>)

  • Prev by Date: [self controlView] in an NSTableView
  • Next by Date: RE: Tons of fun w/NSComboBox
  • Previous by thread: Re: scribbling
  • Next by thread: Re: Drawing while handling events (was Re: scribbling)
  • Index(es):
    • Date
    • Thread