• 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: Brad Carter <email@hidden>
  • Date: Tue, 24 Jul 2007 14:31:56 -0600

I'm not sure about preventing it moving but here's a method I used. It takes advantage of the NSNotification windowDidMove:

It's been about 3 months since I did any programing and I'm very new so there might be something I'm overlooking but hopefully this will give you a good start. screenRect is a global NSRect and MAINWINDOWHEIGHT is defined in my .h file as 550 (your window height would be different).

- (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];
}


-Brad

On Jul 24, 2007, at 1:09 PM, Tomas Zahradnicky wrote:

Dear Cocoa developers,

our app occasionally needs to prevent users to move (and/or resize) a cocoa window with a titlebar. I've successfully solved the resize by overriding setFrame:... methods and that seems to perfectly work. On the other hand, I'm quite desperate with the move as windowserver moves the window and I can only know that the window will move via the notification.

Is there a way to interrupt the window move after being notified with the windowWillMove notification?

All the best,

  Tomas Zahradnicky

# Ing. Tomas Zahradnicky, Jr.
# Assistant Professor
# The Czech Technical University
# Dept of Computer Science, FEE-CTU Prague



_______________________________________________

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

_______________________________________________

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


  • Follow-Ups:
    • Re: Cancelling a window move
      • From: ∞ <email@hidden>
References: 
 >Cancelling a window move (From: Tomas Zahradnicky <email@hidden>)

  • Prev by Date: Re: How useful are bit operators?
  • Next by Date: Re: NSArrayController can't removeObject(s) because of missing managed object context
  • Previous by thread: Cancelling a window move
  • Next by thread: Re: Cancelling a window move
  • Index(es):
    • Date
    • Thread