Reputation: 177
I'm using ::RunAppModalLoopForWindow(WindowPtr)
to run a carbon window as modal. But at some point I need to show/hide all application's windows with:
NSArray* windowNumbers = [NSWindow windowNumbersWithOptions:0];
for (NSNumber* windowNumber in windowNumbers)
{
NSWindow* window = [[NSApplication sharedApplication] windowWithWindowNumber:[windowNumber integerValue]];
[window setAlphaValue:CGFloat(showFlag)];
}
But window is NSCarbonWindow*
that does not respond to setAlphaValue
, and thus, the window is not changing its visibility.
Also, I don't know where NSCarbonWindow
is defined so I can cast from NSWindow
to NSCarbonWindow.
Upvotes: 0
Views: 147
Reputation: 22707
How about:
if ([window respondsToSelector: @selector(setAlphaValue:)])
[window setAlphaValue:CGFloat(showFlag)];
else if (showFlag)
ShowWindow( [window windowRef] );
else
HideWindow( [window windowRef] );
Upvotes: 1