|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
welcome to errorville... population me... (code snippet / please help)
hi there... i know some of you will look at this code and roll your eyes until they fall out, but it's the farthest i've come over the past several hours to making this code snippet make any sense to me, and at the risk of ridicule, i'm seeking help.
the window starts in full screen... i've simply created two IBActions (full screen mode and window mode) that i want to change the NSwindow's screen mode... simple right? yeahh... right... Code:
#import "mainWindow.h"
#import <Carbon/Carbon.h>
@implementation mainWindow
- (id) initWithContentRect: (NSRect) contentRect
styleMask: (unsigned int) aStyle
backing: (NSBackingStoreType) bufferingType
defer: (BOOL) flag
{
self = [super initWithContentRect: contentRect
styleMask: NSBorderlessWindowMask
backing: bufferingType
defer: flag];
SetSystemUIMode(kUIModeAllHidden, 0);
[self setFrame:[[NSScreen mainScreen] visibleFrame] display:YES animate:NO];
SetSystemUIMode(kUIModeAllSuppressed, 0);
return self;
}
- (IBAction)goWindowMode:(id)sender {
[super initWithContentRect: contentRect
styleMask: NSResizableWindowMask | NSMiniaturizableWindowMask
backing: bufferingType
defer: flag];
SetSystemUIMode(kUIModeNormal, 0);
[self setFrame:[[NSWindow mainWindow] visibleFrame] display:YES animate:NO];
}
- (IBAction)goFullScreenMode:(id)sender {
}
@end
|
|
|
|
0
|
|
|
#2 |
|
Code:
- (IBAction)goWindowMode:(id)sender {
[super initWithContentRect: contentRect
styleMask: NSResizableWindowMask | NSMiniaturizableWindowMask
backing: bufferingType
defer: flag];
SetSystemUIMode(kUIModeNormal, 0);
[self setFrame:[[NSWindow mainWindow] visibleFrame] display:YES animate:NO];
}
Second, when you're changing the window frame, you're just setting it to be full screen again. You need to create a new NSRect and set it to that. For example: Code:
[self setFrame:NSMakeRect(50, 50, 200, 200) display:YES animate:NO]; |
|
|
|
0
|
|
|
#3 |
|
I've never programmed for the mac (I'm a Java junkie) but I'm guessing a screenshot of the error (Or stacktrace, if Objective-c has those) would be helpeful for those who actually know objective-c.
Good Luck. |
|
|
|
0
|
|
|
#4 |
|
Also, you need to pay attention to compiler warnings. They alone should tell you that this code won't work.
|
|
|
|
0
|
|
|
#5 |
|
Code:
- (IBAction)goWindowMode:(id)sender {
styleMask: NSResizableWindowMask | NSMiniaturizableWindowMask
}
but thanks for the following code example: Code:
[self setFrame:NSMakeRect(50, 50, 200, 200) display:YES animate:NO]; |
|
|
|
0
|
|
|
#6 |
|
You can't change the styleMask once the window has been created. I'd suggest creating a separate window for your full screen window, and use the setContentView: method to synchronize the content views of both windows.
See Apple's example at /Developer/Examples/Quartz/Core Image/FunHouse. They manage two NSWindowControllers - one for full screen, and one for normal. Last edited by kainjow; Nov 14, 2007 at 02:00 PM. |
|
|
|
0
|
|
|
#7 |
|
oh ok... that kinda makes sense then... i was just hoping that the style mask could be dynamically changed thru if/else statements or something... thanks for the help.
|
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| Welcome to USA! Welcome to the 3rd World, Home of low wage, no benefit jobs. | Ugg | Politics, Religion, Social Issues | 161 | Apr 25, 2011 09:49 AM |
| Bad Company 2 Beta - Who is with me???! (Codes available!) | SchneiderMan | Console Games | 13 | Nov 19, 2009 07:41 PM |
| Did you get a Glossy/ Matted Screen MBP? (Will buy MBP today, please help) | MiniMini | MacBook Pro | 84 | Jul 3, 2009 01:42 PM |
| Let me be first to say...Welcome to Canada! | dornoforpyros | Politics, Religion, Social Issues | 9 | Nov 4, 2004 12:47 AM |
All times are GMT -5. The time now is 08:14 PM.






Linear Mode

