cocoa - Creating an NSWindow that floats over all other windows in the app but not over windows from other apps -
i trying make nswindow show on top in application don't want float on other apps have become active. have tired following code makes window float on other applications:
nsrect frame = nsmakerect(100, 100, 800, 800); mywindow = [[nswindow alloc] initwithcontentrect:frame stylemask:nsborderlesswindowmask backing:nsbackingstorebuffered defer:no]; [mywindow setlevel:nsfloatingwindowlevel ]; [mywindow setbackgroundcolor:[nscolor bluecolor]]; [mywindow makekeyandorderfront:nsapp];
i have tried of constants listed in nswindow documentation , did not find 1 make nswindow float on other windows in not other windows of other active apps. not possible?
there's no built-in support that. might consider setting window hide on deactivate.
alternatively, can have window controller observe nsapplicationwillresignactivenotification
, nsapplicationdidbecomeactivenotification
notifications , adjust window level. when app resign active status, set window level normal. when becomes active again, set float. (if window controlled app delegate, can in -applicationwillresignactive:
, -applicationdidbecomeactive:
delegate methods.)
Comments
Post a Comment