Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'What about smooth resizing in Applescript Studio applications' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
What about smooth resizing in Applescript Studio applications
Authored by: kitzkikz on Aug 08, '03 02:58:42PM

I don't understand what you mean by 'smooth resizing'? The following seems to work well for me (although it is a bit verbose):

set winsize to (size of window 1)
set winx to (item 1 of winsize)
set winy to (item 2 of winsize)
set size of window 1 to {winx / 2, winy / 2}

The window jumps to the new size immediately. Am I missing the point of your question?



[ Reply to This | # ]
What about smooth resizing in Applescript Studio applications
Authored by: DizzyPenguin on Aug 10, '03 02:03:30PM

By "smooth" I mean the window won't 'jump' to the new size but 'stretch', like the login panel in OSX when you've got the one user name displayed, your press spacebar and the window resizes smoothly to show the password field.

---
DizzyPenguin



[ Reply to This | # ]
Smooth resizing - Snippet
Authored by: DizzyPenguin on Aug 10, '03 02:14:38PM
I got this from the Applescript Studio mailing list:
Put the following lines in your main.m file // 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}
But there was no indication of the content of the Application.h file. Any help on this would be greatly appreciated.

---
DizzyPenguin

[ Reply to This | # ]

Smooth resizing - Snippet (correction)
Authored by: DizzyPenguin on Aug 10, '03 02:19:50PM

Sorry, the code should be clearer like this:

put the following lines in your main.m file

// 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}

---
DizzyPenguin



[ Reply to This | # ]
Smooth resizing - Sorted
Authored by: DizzyPenguin on Aug 12, '03 05:52:39AM

OK, I got it working (with a little help from my friends!)

---
DizzyPenguin



[ Reply to This | # ]
RE: Smooth resizing - Snippet (correction)
Authored by: samsprograms on Aug 12, '03 04:50:57PM

How do you get this to work with a toolbar? For me it changes the window's size including the toolbar.



[ Reply to This | # ]