Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Smooth Resizing (again)



> Here's a post from the archives:
> http://lists.apple.com/archives/applescript-studio/2002/Dec/21/
> changingwindowsize.001.txt
>
> Anybody out there willing to explain to a Cocoa newbie how I get the
> following to work in an AS Studio application?

Make new Cocoa class files, calling them something like "CocoaUtilities".
Put that method in the .m file, and change the "-" at the start of the
method to a "+" (skip the import and implementation lines).

Add the following to the .h file
+ (void)resizeWindow :(NSWindow *)window toHeight :(int)height
toWidth:(int)width;


In AppleScript, call the method with:

Call method "resizeWindow:toHeight:toWidth:" of class "CocoaUtilities" with
parameters { theWindowReference, 100, 200}

Think that should do it...

JT



>
> // Thanks to Jan Van Boghout for this code, from his demo app
> "SmoothResize"
>
> #import "Application.h"
>
> @implementation NSApplication (ApplicationName)
>
> - (void)resizeWindow :(NSWindow *)window toHeight :(int)height toWidth
> :(int)width
> {
> NSRect windowFrame,newWindowFrame;
> windowFrame = [NSWindow contentRectForFrameRect:[window frame]
> styleMask:[window styleMask]];
> newWindowFrame = [NSWindow
> frameRectForContentRect:NSMakeRect(NSMinX(windowFrame),NSMaxY(windowFram
> e) - height,width,height) styleMask:[window styleMask]];
>
> [window setFrame:newWindowFrame display:YES animate:YES];
> }
>
> @end
>
> Next, to call on this, use the following syntax:
>
> call method "resizeWindow:toHeight:toWidth:" with parameters {window
> "theWindow", Y, X}
> [/quote]
_______________________________________________
applescript-studio mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-studio
Do not post admin requests to the list. They will be ignored.

References: 
 >Smooth Resizing (again) (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.