Platforms to show: All Mac Windows Linux Cross-Platform
MAAttachedWindowMBS class Deprecated
Super class: NSWindowMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Window | MBS MacExtras Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
For Mac OS X 10.7 you can use NSPopoverMBS. This class does something similar for Mac OS X 10.4 to 10.7.
Base on MAAttachedWindow code by Matt Gemmell.
See his website http://mattgemmell.com/
Below are the positions the attached window can be displayed at.
ote that these positions are relative to the point passed to the constructor, e.g. MAPositionBottomRight will put the window below the point and towards the right, MAPositionTop will horizontally center the window above the point, MAPositionRightTop will put the window to the right and above the point, and so on.
You can also pass MAPositionAutomatic and the attached window will try to position itself sensibly, based on available screen-space.
Notes regarding automatically-positioned attached windows:
(a) The window prefers to position itself horizontally centered below the specified point. This gives a certain enhanced visual sense of an attachment/relationship.
(b) The window will try to align itself with its parent window (if any); i.e. it will attempt to stay within its parent window's frame if it can.
(c) The algorithm isn't perfect. :) If in doubt, do your own calculations and then explicitly request that the window attach itself to a particular side.
Notes regarding accessor methods:
1. The border is drawn inside the viewMargin area, expanding inwards; it does not increase the width/height of the window. You can use the BorderWidth and ViewMargin methods together to achieve the exact look/geometry you want. (viewMargin is the distance between the edge of the view and the window edge.)
2. The specified setter methods are primarily intended to be used _before_ the window is first shown. If you use them while the window is already visible, be aware that they may cause the window to move and/or resize, in order to stay anchored to the point specified in the initializer. They may also cause the view to move within the window, in order to remain centered there.
Note that the HasArrow method can safely be used at any time, and will not cause moving/resizing of the window. This is for convenience, in case you want to add or remove the arrow in response to user interaction. For example, you could make the attached window movable by its background, and if the user dragged it away from its initial point, the arrow could be removed. This would duplicate how Aperture's attached windows behave.
3. drawsRoundCornerBesideArrow takes effect when the arrow is being drawn at a corner, i.e. when it's not at one of the four primary compass directions. In this situation, if drawsRoundCornerBesideArrow is true (the default), then that corner of the window will be rounded just like the other three corners, thus the arrow will be inset slightly from the edge of the window to allow room for the rounded corner. If this value is false, the corner beside the arrow will be a square corner, and the other three corners will be rounded.
This is useful when you want to attach a window very near the edge of another window, and don't want the attached window's edge to be visually outside the frame of the parent window.
4. Note that to retrieve the background color of the window, you should use the windowBackgroundColor method, instead of backgroundColor. This is because we draw the entire background of the window (rounded path, arrow, etc) in an NSColor pattern image, and set it as the backgroundColor of the window.
Subclass of the NSWindowMBS class.
- 9 properties
- property arrowBaseWidth as Double
- property arrowHeight as Double
- property borderColor as NSColorMBS
- property borderWidth as Double
- property cornerRadius as Double
- property drawsRoundCornerBesideArrow as boolean
- property hasArrow as boolean
- property viewMargin as Double
- property windowBackgroundColor as NSColorMBS
- 4 methods
- method Constructor(view as NSViewMBS, point as NSPointMBS = nil, window as NSWindowMBS = nil, onSide as Integer = 12, distance as Double = 0.0)
- method setBackgroundImage(image as NSImageMBS)
- method setPoint(point as NSPointMBS, side as Integer)
- method side as Integer
- shared method attachedWindow(view as NSViewMBS, point as NSPointMBS = nil, window as NSWindowMBS = nil, onSide as Integer = 12, distance as Double = 0.0) as MAAttachedWindowMBS
- 13 constants
Position constants
Constant | Value | Description |
---|---|---|
MAPositionAutomatic | 12 |
automatic |
MAPositionBottom | 1 |
bottom |
MAPositionBottomLeft | 10 |
bottom left |
MAPositionBottomRight | 11 |
bottom right |
MAPositionLeft | 0 |
left |
MAPositionLeftBottom | 5 |
left bottom |
MAPositionLeftTop | 4 |
left top |
MAPositionRight | 2 |
right |
MAPositionRightBottom | 7 |
right bottom |
MAPositionRightTop | 6 |
right top |
MAPositionTop | 3 |
top |
MAPositionTopLeft | 8 |
top left |
MAPositionTopRight | 9 |
top right |
Super class NSWindowMBS
- 88 properties
- property acceptsMouseMovedEvents as boolean
- property allowsConcurrentViewDrawing as boolean
- property allowsToolTipsWhenApplicationIsInactive as boolean
- property alphaValue as Double
- property animationBehavior as Integer
- property aspectRatio as NSSizeMBS
- property Autodisplay as boolean
- property backgroundColor as NSColorMBS
- property backingLocation as Integer
- property backingScaleFactor as Double
- property backingType as Integer
- property canBecomeKeyWindow as boolean
- property canBecomeMainWindow as boolean
- property canBecomeVisibleWithoutLogin as boolean
- property canHide as boolean
- property canStoreColor as boolean
- property className as string
- property classPath as string
- property collectionBehavior as Integer
- property colorSpace as NSColorSpaceMBS
- property contentAspectRatio as NSSizeMBS
- property contentLayoutRect as NSRectMBS
- property contentMaxSize as NSSizeMBS
- property contentMinSize as NSSizeMBS
- property contentResizeIncrements as NSSizeMBS
- property contentView as NSViewMBS
- property currentEvent as NSEventMBS
- property deepestScreen as NSScreenMBS
- property depthLimit as Integer
- property displaysWhenScreenProfileChanges as boolean
- property frame as NSRectMBS
- property hasDynamicDepthLimit as boolean
- property hasShadow as boolean
- Property Height as Double
- property hidesOnDeactivate as boolean
- property identifier as string
- property ignoresMouseEvents as boolean
- property initialFirstResponder as NSViewMBS
- property isDocumentEdited as boolean
- property isExcludedFromWindowsMenu as boolean
- property isFlushWindowDisabled as boolean
- property isKeyWindow as boolean
- property isMainWindow as boolean
- property isMiniaturized as boolean
- property isMovableByWindowBackground as boolean
- property isOnActiveSpace as boolean
- property isOneShot as boolean
- property isOpaque as boolean
- property isSheet as boolean
- property isZoomed as boolean
- Property Left as Double
- property Level as Integer
- property maxSize as NSSizeMBS
- property miniwindowImage as Variant
- property miniwindowTitle as String
- property minSize as NSSizeMBS
- property Movable as boolean
- property parentWindow as NSWindowMBS
- property preferredBackingLocation as Integer
- property preservesContentDuringLiveResize as boolean
- property preventsApplicationTerminationWhenModal as boolean
- property representedFile as folderitem
- property representedFilename as string
- property representedURL as string
- property resizeIncrements as NSSizeMBS
- property Restorable as boolean
- property screen as NSScreenMBS
- property sharingType as Integer
- property showsResizeIndicator as boolean
- property showsToolbarButton as boolean
- property styleMask as Integer
- property SubTitle as String
- property tabbingIdentifier as String
- property tabbingMode as Integer
- property Title as String
- property titlebarAppearsTransparent as Boolean
- property titlebarSeparatorStyle as Integer
- property titleVisibility as Integer
- property toolbar as Variant
- property toolbarStyle as Integer
- Property Top as Double
- property viewsNeedDisplay as boolean
- property Visible as boolean
- Property Width as Double
- property windowController as NSWindowControllerMBS
- property windowNumber as Integer
- property worksWhenModal as boolean
- property frameAutosaveName as string
- 2 shared properties
- shared property allowsAutomaticWindowTabbing as Boolean
- shared property userTabbingPreference as Integer
- 114 methods
- method addChildWindow(win as DesktopWindow, order as integer)
- method addChildWindow(win as NSWindowMBS, order as Integer)
- method addChildWindow(win as window, order as Integer)
- method addTabbedWindow(win as NSWindowMBS, ordered as Integer)
- method animator as NSWindowMBS
- method areCursorRectsEnabled as boolean
- method attachedSheet as NSWindowMBS
- method autorecalculatesContentBorderThicknessForEdge(edge as Integer) as boolean
- method becomeKeyWindow
- method becomeMainWindow
- method cacheImageInRect(r as NSRectMBS)
- method Center
- method childWindows as NSWindowMBS()
- method ClearFocus
- method Close
- method Constructor(w as DesktopWindow)
- method Constructor(w as window)
- method Constructor(x as Double, y as Double, w as Double, h as Double, styleMask as Integer, BackingStoreType as Integer = 0, deferCreation as boolean = false, canBecomeKeyWindow as boolean = false)
- method contentBorderThicknessForEdge(edge as Integer) as Double
- method contentRectForFrameRect(windowFrame as NSRectMBS) as NSRectMBS
- method convertBaseToScreen(p as NSPointMBS) as NSPointMBS
- method convertScreenToBase(p as NSPointMBS) as NSPointMBS
- method dataWithEPSInsideRect(r as NSRectMBS) as Memoryblock
- method dataWithPDFInsideRect(r as NSRectMBS) as Memoryblock
- method deminiaturize
- method disableCursorRects
- method disableFlushWindow
- method disableScreenUpdatesUntilFlush
- method disableSnapshotRestoration
- method discardCachedImage
- method discardCursorRects
- method display
- method displayIfNeeded
- method dockTile as Variant
- method dragImage(image as NSImageMBS, viewLocation as NSPointMBS, offset as NSSizeMBS, NSEvent as NSEventMBS, pboard as NSPasteboardMBS, source as NSViewMBS, slideFlag as boolean)
- method enableCursorRects
- method enableFlushWindow
- method enableSnapshotRestoration
- method endEditingFor(anObject as object = nil)
- method fieldEditor(createFlag as boolean = True, forObject as object = nil) as Variant
- method firstResponder as NSResponderMBS
- method flushWindow
- method flushWindowIfNeeded
- method frameRectForContentRect(windowContent as NSRectMBS) as NSRectMBS
- method GetFrame(byref left as Double, byref top as Double, byref width as Double, byref height as Double)
- method gState as Integer
- method Hide
- method inLiveResize as boolean
- method invalidateCursorRectsForView(View as NSViewMBS)
- method invalidateRestorableState
- method invalidateShadow
- method keyDown(e as NSEventMBS)
- method makeFirstResponder(r as NSResponderMBS) as boolean
- method makeKeyAndOrderFront
- method makeKeyWindow
- method makeMainWindow
- method mergeAllWindows
- method miniaturize
- method moveTabToNewWindow
- method orderBack
- method orderFront
- method orderFrontRegardless
- method orderOut
- method PerformClose
- method performMiniaturize
- method performWindowDragWithEvent(event as NSEventMBS)
- method performZoom
- method print
- method registerForDraggedTypes(Types() as string)
- method removeChildWindow(win as NSWindowMBS)
- method removeChildWindow(win as window)
- method resetCursorRects
- method resignKeyWindow
- method resignMainWindow
- method resizeFlags as Integer
- method restoreCachedImage
- method runToolbarCustomizationPalette
- method saveFrameUsingName(s as String)
- method selectKeyViewFollowingView(view as NSViewMBS)
- method selectKeyViewPrecedingView(view as NSViewMBS)
- method selectNextKeyView
- method selectNextTab
- method selectPreviousKeyView
- method selectPreviousTab
- method sendEvent(e as NSEventMBS)
- method setAutorecalculatesContentBorderThickness(flag as boolean, edge as Integer)
- method setBottomCornerRounded(flag as boolean)
- method setContentBorderThickness(thickness as Double, edge as Integer)
- method setContentSize(size as NSSizeMBS)
- method setFrame(frameRect as NSRectMBS)
- method setFrame(frameRect as NSRectMBS, display as boolean)
- method setFrame(frameRect as NSRectMBS, display as boolean, animated as boolean)
- method SetFrame(left as Double, top as Double, width as Double, height as Double)
- method setFrameAutosaveName(name as String) as boolean
- method setFrameFromString(s as String)
- method setFrameOrigin(point as NSPointMBS)
- method setFrameTopLeftPoint(point as NSPointMBS)
- method setFrameUsingName(name as String, force as boolean = false) as boolean
- method setRestorationClass
- method setTitleWithRepresentedFile(filename as folderitem)
- method setTitleWithRepresentedFilename(filename as string)
- method Show
- method standardWindowButton(button as Integer) as Variant
- method stringWithSavedFrame as String
- method tabbedWindows as NSWindowMBS()
- method toggleFullScreen
- method toggleTabBar
- method toggleToolbarShown
- method toolbarview as NSViewMBS
- method unregisterDraggedTypes
- method update
- method useOptimizedDrawing(value as boolean)
- method WindowHandle as Integer
- method zoom
- 44 shared methods
- shared method contentRectForFrameRect(windowFrame as NSRectMBS, styleMask as UInt32) as NSRectMBS
- shared method frameRectForContentRect(windowContentRect as NSRectMBS, styleMask as UInt32) as NSRectMBS
- shared method minFrameWidthWithTitle(WindowTitle as string, styleMask as UInt32) as Double
- shared method NSDockWindowLevel as Integer
- shared method NSFloatingWindowLevel as Integer
- shared method NSMainMenuWindowLevel as Integer
- shared method NSModalPanelWindowLevel as Integer
- shared method NSNormalWindowLevel as Integer
- shared method NSPopUpMenuWindowLevel as Integer
- shared method NSScreenSaverWindowLevel as Integer
- shared method NSStatusWindowLevel as Integer
- shared method NSSubmenuWindowLevel as Integer
- shared method NSTornOffMenuWindowLevel as Integer
- shared method NSWindowDidBecomeKeyNotification as string
- shared method NSWindowDidBecomeMainNotification as string
- shared method NSWindowDidChangeScreenNotification as string
- shared method NSWindowDidChangeScreenProfileNotification as string
- shared method NSWindowDidDeminiaturizeNotification as string
- shared method NSWindowDidEndLiveResizeNotification as string
- shared method NSWindowDidEndSheetNotification as string
- shared method NSWindowDidEnterFullScreenNotification as string
- shared method NSWindowDidEnterVersionBrowserNotification as string
- shared method NSWindowDidExitFullScreenNotification as string
- shared method NSWindowDidExitVersionBrowserNotification as string
- shared method NSWindowDidExposeNotification as string
- shared method NSWindowDidMiniaturizeNotification as string
- shared method NSWindowDidMoveNotification as string
- shared method NSWindowDidResignKeyNotification as string
- shared method NSWindowDidResignMainNotification as string
- shared method NSWindowDidResizeNotification as string
- shared method NSWindowDidUpdateNotification as string
- shared method NSWindowWillBeginSheetNotification as string
- shared method NSWindowWillCloseNotification as string
- shared method NSWindowWillEnterFullScreenNotification as string
- shared method NSWindowWillEnterVersionBrowserNotification as string
- shared method NSWindowWillExitFullScreenNotification as string
- shared method NSWindowWillExitVersionBrowserNotification as string
- shared method NSWindowWillMiniaturizeNotification as string
- shared method NSWindowWillMoveNotification as string
- shared method NSWindowWillStartLiveResizeNotification as string
- shared method removeFrameUsingName(name as string)
- shared method standardWindowButton(button as Integer, StyleMask as Integer) as Variant
- shared method windowNumberAtPoint(x as Double, y as Double, belowWindowWithWindowNumber as Integer = 0) as Integer
- shared method windowNumbersWithOptions(options as Integer = 0) as Integer()
- 68 constants
Super class NSResponderMBS
- 3 properties
- property Handle as Integer
- property menu as NSMenuMBS
- property nextResponder as NSResponderMBS
- 123 methods
- method beginGestureWithEvent(e as NSEventMBS)
- method cancelOperation
- method capitalizeWord
- method centerSelectionInVisibleArea
- method changeCaseOfLetter
- method complete
- method Constructor Private
- method cursorUpdate(e as NSEventMBS)
- method deleteBackward
- method deleteBackwardByDecomposingPreviousCharacter
- method deleteForward
- method deleteToBeginningOfLine
- method deleteToBeginningOfParagraph
- method deleteToEndOfLine
- method deleteToEndOfParagraph
- method deleteToMark
- method deleteWordBackward
- method deleteWordForward
- method endGestureWithEvent(e as NSEventMBS)
- method flagsChanged(e as NSEventMBS)
- method flushBufferedKeyEvents
- method helpRequested(e as NSEventMBS)
- method indent
- method insertBacktab
- method insertContainerBreak
- method insertDoubleQuoteIgnoringSubstitution
- method insertLineBreak
- method insertNewline
- method insertNewlineIgnoringFieldEditor
- method insertParagraphSeparator
- method insertSingleQuoteIgnoringSubstitution
- method insertTab
- method insertTabIgnoringFieldEditor
- method keyDown(e as NSEventMBS)
- method keyUp(e as NSEventMBS)
- method lowercaseWord
- method magnifyWithEvent(e as NSEventMBS)
- method makeBaseWritingDirectionLeftToRight
- method makeBaseWritingDirectionNatural
- method makeBaseWritingDirectionRightToLeft
- method makeTextWritingDirectionLeftToRight
- method makeTextWritingDirectionNatural
- method makeTextWritingDirectionRightToLeft
- method mouseDown(e as NSEventMBS)
- method mouseDragged(e as NSEventMBS)
- method mouseEntered(e as NSEventMBS)
- method mouseExited(e as NSEventMBS)
- method mouseMoved(e as NSEventMBS)
- method mouseUp(e as NSEventMBS)
- method moveBackward
- method moveBackwardAndModifySelection
- method moveDown
- method moveDownAndModifySelection
- method moveForward
- method moveForwardAndModifySelection
- method moveLeft
- method moveLeftAndModifySelection
- method moveParagraphBackwardAndModifySelection
- method moveParagraphForwardAndModifySelection
- method moveRight
- method moveRightAndModifySelection
- method moveToBeginningOfDocument
- method moveToBeginningOfDocumentAndModifySelection
- method moveToBeginningOfLine
- method moveToBeginningOfLineAndModifySelection
- method moveToBeginningOfParagraph
- method moveToBeginningOfParagraphAndModifySelection
- method moveToEndOfDocument
- method moveToEndOfDocumentAndModifySelection
- method moveToEndOfLine
- method moveToEndOfLineAndModifySelection
- method moveToEndOfParagraph
- method moveToEndOfParagraphAndModifySelection
- method moveToLeftEndOfLine
- method moveToLeftEndOfLineAndModifySelection
- method moveToRightEndOfLine
- method moveToRightEndOfLineAndModifySelection
- method moveUp
- method moveUpAndModifySelection
- method moveWordBackward
- method moveWordBackwardAndModifySelection
- method moveWordForward
- method moveWordForwardAndModifySelection
- method moveWordLeft
- method moveWordLeftAndModifySelection
- method moveWordRight
- method moveWordRightAndModifySelection
- method otherMouseDown(e as NSEventMBS)
- method otherMouseDragged(e as NSEventMBS)
- method otherMouseUp(e as NSEventMBS)
- method pageDown
- method pageDownAndModifySelection
- method pageUp
- method pageUpAndModifySelection
- method performMnemonic(theString as string) as boolean
- method presentError(e as NSErrorMBS) as boolean
- method rightMouseDown(e as NSEventMBS)
- method rightMouseDragged(e as NSEventMBS)
- method rightMouseUp(e as NSEventMBS)
- method rotateWithEvent(e as NSEventMBS)
- method scrollLineDown
- method scrollLineUp
- method scrollPageDown
- method scrollPageUp
- method scrollToBeginningOfDocument
- method scrollToEndOfDocument
- method scrollWheel(e as NSEventMBS)
- method selectAll
- method selectLine
- method selectParagraph
- method selectToMark
- method selectWord
- method setMark
- method showContextHelp
- method swapWithMark
- method swipeWithEvent(e as NSEventMBS)
- method tabletPoint(e as NSEventMBS)
- method tabletProximity(e as NSEventMBS)
- method transpose
- method transposeWords
- method undoManager as NSUndoManagerMBS
- method uppercaseWord
- method yank
This class has no sub classes.
Some examples using this class:
- /MacExtras/Attached Window
- /MacExtras/MAAttachedWindow/MAAttachedWindow Demo
- /MacExtras/MAAttachedWindow/MAAttachedWindow Test
Blog Entries
- MBS Xojo Plugins, version 22.5pr7
- Cleanup Xojo Plugins
- MBS Xojo Plugins, version 20.5pr8
- MBS Real Studio Plugins, version 11.3pr4
- Lion features for Real Studio
- MBS Real Studio Plugins, version 11.2pr11
- MBS Real Studio Plugins, version 11.2pr9
Release notes
- Version 22.5
- Deprecated MAAttachedWindowMBS classes.
- Version 20.5
- Optimized a few more flags: iTunesLibraryMBS, GrowlMBS, AuthorizationMBS, SUUpdaterMBS, SpinningProgressIndicatorMBS, NSHelpManagerMBS and MAAttachedWindowMBS classes are now desktop only.
The items on this page are in the following plugins: MBS MacBase Plugin, MBS MacExtras Plugin.
LTCSMPTETimecodeMBS - MacAliasMBS