• 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: Problem redrawing views while window resize button is held
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem redrawing views while window resize button is held


  • Subject: Re: Problem redrawing views while window resize button is held
  • From: Doug F <email@hidden>
  • Date: Thu, 15 Mar 2007 12:25:59 -0400

Hi all,

Thanks for the thoughts.

After reading about these ideas, I "solved" the problem in my controller with the following kluge:

The controller has an entry point from the model that says "my data has changed; update the view." That usually simply called the (custom) view's setNeedsDisplay:YES message. The model's timer keeps ticking while the resize is in progress, and this method IS called, even though nothing is displayed.

I have now added another part after it, very simple:

if ([customView inLiveResize])
	[customView displayIfNeeded];

Now, it works as expected, although the latency is somewhat increased (I had a NSLog of timer intervals) during this time period.

Cheers,

Doug

On Mar 15, 2007, at 9:47 AM, Robert Clair wrote:

You can probably do it, but it will be *very* messy.

Many of the controls track the mouse by grabbing control at mouse down and then polling for mouseDragged and mouseUp by calling:

 -[NSWindow nextEventMatchingMask:]


The widow resize isn't doing that. A mouse down on the resize corner starts polling NSApp directly by calling:


-[NSApp nextEventMatchingMask:untilDate:inMode:dequeue:]

with a mask of 68.

This then blocks waiting for a left mouse drag or up. When it does get a drag, it does the resize and polls again.

(I have instrumented versions of NSApplication and NSWindow with lots of logging.)

So... you might be able to something very ugly along the lines of:

* Subclass NSApplication and override -[NSApp nextEventMatchingMask:untilDate:inMode:dequeue:]

* Determine through whatever combination of overrides and flags that you are here because you've pushed the mouse button on the resize handle.


* Call drawRect on your view yourself and flush the window yourself.

* Post an NSApplicationDefined event to the queue

* Change the mask to include NSApplicationDefined and call super

* When the call to super finally returns check the event type. If it is a drag or up, return. Otherwise do the drawing manually again, post another event, and call super again. You might want to put a small sleep in there to avoid churning.

...Bob

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
40dpf.cc


This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Problem redrawing views while window resize button is held (From: Robert Clair <email@hidden>)

  • Prev by Date: Re: Getting colour data at specified point in an NSImage
  • Next by Date: NSTextView: container size and text alignment
  • Previous by thread: Re: Problem redrawing views while window resize button is held
  • Next by thread: Calling cocoa app from command line
  • Index(es):
    • Date
    • Thread