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)



Right, sorry - the .h file should contain:
#import <Cocoa/Cocoa.h>

That should bring in all the classes you need to define the objects and
functions that are causing you trouble.

Your reference to a window in AppleScript can be handed straight to this
method as the argument - Studio automagically handles the transition
gracefully (for windows, at least).

As an aside, by the way you wrote it, the .h file seems to be importing
itself - I'm assuming that's inaccurate, but you should get rid of that if
it isn't.

JT


> Thanks for your input, much appreciated, but a bit more help would be
> needed for me to get it working.
> I'm getting closer (I think) but obviously missing something.
>
> So far I've created a Cocoa class and added the 2 files (.h and .m) in
> the 'Resources' folder of my application.
>
> File called 'CocoaUtilities.h' as the following:
>
> #import <CocoaUtilities.h>
>
> @interface CocoaUtilities : NSObject {
>
> }
>
> + (void)resizeWindow :(NSWindow *)window toHeight :(int)height
> toWidth:(int)width;
>
> @end
>
> Then I've got 'CocoaUtilities.m' which has the following:
>
> #import "CocoaUtilities.h"
>
> @implementation CocoaUtilities
>
> + (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
_______________________________________________
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: 
 >Re: 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.