| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Thanks John,--
I'm getting very, very close now. It compiles properly now with the
amendments made but I get a "NS InternalScriptError (8)" with the
message:
" -[NSCFString frame]: selector not recognized" in the log window.
Here's the snippet of AS code I'm using:
on clicked theObject
tell window "w_main"
if name of theObject is "size" then
my resize()
end if
end tell
end clicked
on resize()
call method "resizeWindow:toHeight:toWidth:" of class "CocoaUtilities"
with parameters {"w_main", 400, 400}
end resize
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(windowF r
am
e) - height,width,height) styleMask:[window styleMask]];
[window setFrame:newWindowFrame display:YES animate:YES];
}
@end
| References: | |
| >Re: Smooth Resizing (again) (From: email@hidden) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.