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

hoschi

macrumors newbie
Original poster
Sep 20, 2005
29
0
Hi:

I have a program running which uses fullscreen mode also- that is I can go full screen as well. I have a custom view in this window (where I show some opengl stuff) and some buttons/controls..

The problem is this..
Once I go to the fullscreen and come back, my normal sized window cannot display the custom view but only displays the normal window with controls and without the custom view itself..

I read somewhere that in order for any other views to be shown, they should be made subviews of the content view. I have no clue how to do that.

Also if anyone thinks there is another way around this, it could be helpful...
Below is the relevant part of the code...

---------

-(IBAction)fullScreen:(id)sender
{
if (fullScreenMode)
{
[fullScreenWindow close];
[startingWindow setAcceptsMouseMovedEvents:YES];
// [startingWindow setContentView:];
[startingWindow makeKeyAndOrderFront:nil];
// [startingWindow makeFirstResponder:myGLView];
fullScreenMode = NO;
} else
{
unsigned int windowStyle;
NSRect contentRect;
startingWindow = [NSApp keyWindow];
windowStyle = NSBorderlessWindowMask;
contentRect = [[NSScreen mainScreen] frame];
fullScreenWindow = [[NSWindow alloc] initWithContentRect:contentRect
styleMask:windowStyle
backing:NSBackingStoreBuffered
defer:NO];
[startingWindow setAcceptsMouseMovedEvents:NO];

if(fullScreenWindow != nil)
{
[fullScreenWindow setTitle:mad:"GL Viewer"];
[fullScreenWindow setReleasedWhenClosed:YES];
[fullScreenWindow setAcceptsMouseMovedEvents:YES];
[fullScreenWindow setContentView:myGLView];
[fullScreenWindow makeKeyAndOrderFront:myGLView];
[fullScreenWindow setLevel:NSScreenSaverWindowLevel -1];
[fullScreenWindow makeFirstResponder:myGLView];
fullScreenMode = YES;
}
}
}
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
hoschi said:
...I read somewhere that in order for any other views to be shown, they should be made subviews of the content view. I have no clue how to do that.

This is easy:
Code:
NSWindow *window = <code to get window>;
NSView *view = <code to get view>;

[[window contentView] addSubview:view];
<set view frame etc>

p.s. if you wrap you code in CODE tags it's a bit easier to read :)
 

HiRez

macrumors 603
Jan 6, 2004
6,250
2,576
Western US
hoschi said:
I read somewhere that in order for any other views to be shown, they should be made subviews of the content view. I have no clue how to do that.
Just use
Code:
[[myWindow contentView] addSubview:mySubview]
 

hoschi

macrumors newbie
Original poster
Sep 20, 2005
29
0
HiRez said:
Heh, I just changed that too!
I added the line and added [[myWindow contentView] addSubview:myView]

HoweverI am getting the same problem as before
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Can you host the XCode project somewhere (as a zip or something). The code above is a bit difficult to understand on it's own...
 

HiRez

macrumors 603
Jan 6, 2004
6,250
2,576
Western US
hoschi said:
I added the line and added [[myWindow contentView] addSubview:myView]

HoweverI am getting the same problem as before
Sorry, in the Mac world, when you see "my<Something>" if usually means "substitute the actual name of the object I'm using here". So in your case it sounds like it would be:
Code:
[[fullScreenWindow contentView] addSubview:myGLView];
Whether that actually works to accomplish what you're going for, I don't know, I'm just going off what you said about adding subviews to a content view.

EDIT: fixed typo...again! :p
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.