4

My app has an icon in the menubar. A NSPanel shows up when I click the icon. But why does the NSPanel not have a background color like other having gray background NSWindow? My NSPanel's background looks like transparent. My NSPanel comes from a .xib file. My code as follows:

(void)openPanel
{

NSLog(@"openPanel");

NSWindow *panel = self.panelController.window;

NSRect rect = [[[NSApp currentEvent] window] frame];
NSLog(@"rect.origin.x = %f",rect.origin.x);
NSLog(@"rect.origin.y = %f",rect.origin.y);
NSLog(@"rect.size.width = %f",rect.size.width);
NSLog(@"rect.size.height = %f",rect.size.height);
[panel setFrame:NSMakeRect(rect.origin.x, rect.origin.y-100, 200, 100) display:YES];
[NSApp activateIgnoringOtherApps:NO];
[panel makeKeyAndOrderFront:nil];

isPanelVisible = YES;
}
Jay
  • 6,572
  • 3
  • 37
  • 65
gohamgx
  • 273
  • 2
  • 16

1 Answers1

1

Generally NSPanels are semi-transparent. See here for more information. If you don't want the semi-transparency you could change NSPanel in IB under custom class from NSPanel to NSWindow.

Equinox2000
  • 576
  • 6
  • 17