Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
hi... i've searched for what i'm assuming should be easy cut+paste cocoa code, but i can't seem to find it...

1) code that will allow my app to essentially start in fullscreen mode with menubar, but also have a key event (like "F" in Photoshop CS3) that will toggle the main window between fullscreen with menu bar, fullscreen, and window... (i don't need any resolution switching code, it's just for the main window)

2) also, does anyone know how to make the main window fade in when it starts up? again, much like Adobe's CS3 apps that quickly fade in and fade out.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
1) code that will allow my app to essentially start in fullscreen mode with menubar, but also have a key event (like "F" in Photoshop CS3) that will toggle the main window between fullscreen with menu bar, fullscreen, and window... (i don't need any resolution switching code, it's just for the main window)

Check out this article from Apple. The function you want is SetSystemUIMode().

There's an example of this at /Developer/Examples/Quartz/Core Image/FunHouse

2) also, does anyone know how to make the main window fade in when it starts up? again, much like Adobe's CS3 apps that quickly fade in and fade out.

NSWindow has a method setAlphaValue: which takes a value from 0.0 to 1.0. You can use this, with a timer, to fade a window.
 

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
it seems i need to somehow declare kUIModeAllHidden and kUIModeNormal functions... ??? ...

i've updated my code here so everyone can totally see what i'm doing wrong: http://www.imagectrl.com/LightTest.zip

i don't believe i'm terribly far off, but of course, i probably am... and i'm still wondering if it's kinda dumb of me (or not) to have 2 seperate objects for the 2 different screen modes... like, i'm probably suppose to have only one object for the screen mode... right?
 

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
ok... including the carbon headers fixed my current errors... but now there is 1 "error" that i'm so not even understanding.

i'm so lost... ridiculous...

here's the updated code: http://www.imagectrl.com/LightTest.zip

or...

if anyone could write a super quick xcode that's simply a window with "full screen mode" / "window mode" menu items so that i can learn how to do it SetSystemUIMode() visually and send it to me, that would be perfect...
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
You need to add Carbon.framework to your project, and #import it via
Code:
#import <Carbon/Carbon.h>
Then to go into full screen, use
Code:
SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar);
To go back use
Code:
SetSystemUIMode(kUIModeNormal, 0);
You also have to set the window's frame to be the screen's frame. Do this via the setFrame:display:animate: method, and you can get the screen's frame via the NSScreen class.
 

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
You also have to set the window's frame to be the screen's frame. Do this via the setFrame:display:animate: method, and you can get the screen's frame via the NSScreen class.

ok... the SetSystemUIMode seems to be working for me now... i had to add the carbon.framework file to make it work and not just write the include headers... now i'm trying to figure out making the window's frame become the screen's frame, and having no luck so far... any examples you could suggest?
 

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
am on on the right track here? or am i WAY off

Code:
- (IBAction)goFullScreenMode:(id)sender {
	[NSWindow setFrame:[[NSScreen mainScreen] visibleFrame] display:YES animate:YES];
	SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar);    
}
 

cblackburn

macrumors regular
Jul 5, 2005
158
0
London, UK
2) also, does anyone know how to make the main window fade in when it starts up? again, much like Adobe's CS3 apps that quickly fade in and fade out.

I did something like this once, you want to have a rifle through the documentation for a class called NSViewAnimation. Although this will limit your app to OS 10.4+, but these days I assume this is less and less a problem...

Chris
 

joaoferro99

macrumors member
Feb 14, 2008
84
0
S. California
Full ScreenMode?

hi I am trying to learn how to put my window into full screen mode.
what I want to do is similar to apple's registeration form - the one you would see right after OS installation.

some textfields on it, some buttons on it.... and full screen without menu bar or launcher.

any example?

thx
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.