- Inherits from:
- NSWindow : NSResponder : NSObject
- Conforms to:
- NSCoding
- (NSResponder)
- NSObject (NSObject)
Declared in:
- AppKit/NSPanel.h
A panel is a special kind of window, typically serving an auxiliary function in an application. NSPanel adds a few special behaviors to NSWindow in support of the role panels play:
In addition to these automatic behaviors, NSPanel allows you to configure certain other behaviors common to some kinds of panels:
- Configuring panel behavior
- - setFloatingPanel:
- - isFloatingPanel
- - setBecomesKeyOnlyIfNeeded:
- - becomesKeyOnlyIfNeeded
- - setWorksWhenModal:
- - worksWhenModal
- (BOOL)becomesKeyOnlyIfNeeded
YES
if
the receiver becomes the key window only when the user clicks a
view object that needs to be first responder to receive event and
action messages; for example if it edits text or otherwise accepts
keyboard input. Returns NO
if it
becomes the key window whenever clicked. NSPanel by default returns NO
,
indicating that panels become key as other windows do.See Also: - setBecomesKeyOnlyIfNeeded:, - needsPanelToBecomeKey (NSView)
- (BOOL)isFloatingPanel
YES
if
the receiver is set to float above normal windows, NO
otherwise. A
floating panel's window level is NSFloatingWindowLevel
.
NSPanels by default returns NO
, indicating
that they inhabit the normal window level.See Also: - setFloatingPanel:, - level (NSWindow)
- (void)setBecomesKeyOnlyIfNeeded:(BOOL)flag
YES
,
the receiver becomes the key window only when keyboard input is
needed; if flag is NO
,
it becomes the key window whenever clicked. This behavior is not
set by default. You should consider setting it only if most controls
in the NSPanel aren't text fields, and if the choices that can
be made by entering text can also be made in another way (such as
by clicking an item in a pick list).See Also: - becomesKeyOnlyIfNeeded, - needsPanelToBecomeKey (NSView)
- (void)setFloatingPanel:(BOOL)flag
YES
,
sets the receiver's window level to NSFloatingWindowLevel
;
if flag is NO
,
sets the receiver's window level to NSNormalWindowLevel
.
The default is NO
. It's appropriate
for an NSPanel to float above other windows only if all of the following
conditions are true:See Also: - isFloatingPanel, - setLevel: (NSWindow)
- (void)setWorksWhenModal:(BOOL)flag
YES
,
the application object sends events to the receiver even during
a modal loop or session; if flag is NO
,
the receiver gets no events while a modal loop or session is running.
See "Modal Windows" in the NSWindow
class specification for more information on modal windows and panels.See Also: - worksWhenModal, - runModalForWindow: (NSApplication), - runModalSession: (NSApplication)
- (BOOL)worksWhenModal
YES
if
the receiver is able to receive keyboard and mouse events even when
some other window is being run modally, NO
otherwise. NSPanels
by default return NO
, indicating
their ineligibility for events during a modal loop or session. See "Modal Windows" in the NSWindow
class specification for more information on modal windows and panels.See Also: - setWorksWhenModal:, - runModalForWindow: (NSApplication), - runModalSession: (NSApplication)