Hi,

I only have one monitor, so I'm having a bit of a problem figuring this out.

I have a (borderless) window that should be displayed on any display
chosen by the user. I figured the code below would do the trick, but
apparently it's a no go (I use setFrameFromString: when the app is
launched; this is when settings are changed during runtime):

NSRect screenRect = [[NSScreen mainScreen] frame];
NSArray *screens = [NSScreen screens];
int preferredDisplay =  [[[NSUserDefaults  standardUserDefaults]
objectForKey:@"PreferredDisplayID"] intValue];

for (id screen in screens ) {
                CGDirectDisplayID display = (CGDirectDisplayID) [[[screen
deviceDescription] valueForKey:@"NSScreenNumber"] unsignedIntValue];
                if ( preferredDisplay == display ) {
                        screenRect = [screen frame];
                        break;
                }
}

[win setFrame:screenRect display:YES];


Please advice.

Thanks
F.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to