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
Super class NSResponderMBS
This class has no sub classes.
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.
Some examples using this class:
- /MacExtras/Attached Window
- /MacExtras/MAAttachedWindow/MAAttachedWindow Demo
- /MacExtras/MAAttachedWindow/MAAttachedWindow Test
Some related classes:
- class iTunesLibraryMBS
- class NSColorMBS
- class NSHelpManagerMBS
- class NSImageMBS
- class NSPointMBS
- class NSPopoverMBS
- class NSViewMBS
- class NSWindowMBS
- class SpinningProgressIndicatorMBS
- class SUUpdaterMBS
The items on this page are in the following plugins: MBS MacExtras Plugin.
LTCSMPTETimecodeMBS - MacAliasMBS