• 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: Cancelling a window move
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cancelling a window move


  • Subject: Re: Cancelling a window move
  • From: arri <email@hidden>
  • Date: Wed, 25 Jul 2007 00:40:51 +0200

probably there's a much better way around this issue,
and it's most likely rather a design issue than a technical problem..

however, if you still need to present your users a non-movable window,
the best way i can think of is to use CGPostMouseEvent().
have a look at the Quartz Event Services reference.
in the windowWillMove: delegate method, simply call

CGPostMouseEvent( CGPointMake(x,y), FALSE, (CGButtonCount) 1, FALSE );

this creates a 'fake' mouseUp event, effectively eliminating the initial mousedown on the titlebar.


besides, if you just needed to subclass NSWindow in order to override setFrame:
there's also this NSWindow delegate


- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize) proposedFrameSize


* a




On Jul 24, 2007, at 10:57 PM, ∞ wrote:

Il giorno 24/lug/07, alle ore 22:31, Brad Carter ha scritto:

- (void)windowDidMove:(NSNotification *)aNotification
{
	NSLog(@"window moved notification received");
	NSPoint windowPoint;
	screenRect = [[NSScreen mainScreen] frame];
	windowPoint.x = 0;
	windowPoint.y = (screenRect.size.height - MAINWINDOWHEIGHT);
	[oMainWindow setFrameOrigin:windowPoint];
}

A better approach may have the window animate back to its former position to provide feedback that it is not movable, rather than confuse the user by jumping back without any feedback. Mac users understand "speeding back" as it is the same animation that happens when you drag an object (ie a file) to a position you cannot drop it into.


(You can find almost-ready animation code in Quinn's source code, in my own AfloatAnimator at the Afloat open source project at Google Code -- warning, LGPL --, or use Cocoa's NSViewAnimation or Leopard's Core Animation.)



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: 
 >Cancelling a window move (From: Tomas Zahradnicky <email@hidden>)
 >Re: Cancelling a window move (From: Brad Carter <email@hidden>)
 >Re: Cancelling a window move (From: ∞ <email@hidden>)

  • Prev by Date: Re: Capturing STDOUT from unit test
  • Next by Date: Re: Capturing STDOUT from unit test
  • Previous by thread: Re: Cancelling a window move
  • Next by thread: NSArrayController can't removeObject(s) because of missing managed object context
  • Index(es):
    • Date
    • Thread