Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSScreenMBS class.

NSScreenMBS.backingScaleFactor as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns the backing store pixel scale factor for the screen.
Example
Msgbox str(NSScreenMBS.mainScreen.backingScaleFactor)

Returns the scale factor representing the number of backing store pixels corresponding to each linear unit in screen space on this NSScreen.
This method is provided for rare cases when the explicit scale factor is needed. Please use the NSView class's convert backing methods whenever possible.
Available in Mac OS X v10.7 and later.

For apps which are not enabled for retina support, the function returns 1. So you only see 2 here if app is Cocoa, display is retina and info.plist has the NSHighResolutionCapable key.
(Read only property)

NSScreenMBS.colorSpace as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the colorSpace of the screen.
Example
dim s as NSScreenMBS = NSScreenMBS.mainScreen
dim c as NSColorSpaceMBS = s.colorSpace
MsgBox c.localizedName

Available in Mac OS X v10.6 and later.

Value is a NSColorSpaceMBS but declared as Variant to reduce plugin interdependencies.
(Read only property)

NSScreenMBS.depth as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the receiver's current bit depth and colorspace information.

Returns the window depth information. This value cannot be used directly. You must pass it to a function such as NSBitsPerPixelFromDepth or NSColorSpaceFromDepth to obtain a concrete value for the desired information.
(Read only property)

NSScreenMBS.deviceDescription as dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the device dictionary for the screen.
Example
Dim dic As Dictionary = NSScreenMBS.mainScreen.deviceDescription

Break // see content in debugger

A dictionary containing the attributes of the receiver's screen.
(Read only property)

NSScreenMBS.frame as NSRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns the dimensions and location of the receiver.
Example
Dim screens() As NSScreenMBS = NSScreenMBS.screens

// show frame for each screen
For Each Screen As NSScreenMBS In screens
MsgBox Screen.frame.String
Next

The full screen rectangle at the current resolution. This rectangle includes any space currently occupied by the menu bar and dock.
(Read only property)

NSScreenMBS.Handle as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
The internal reference to the NSScreen object.

(Read and Write property)

NSScreenMBS.localizedName as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacBase Plugin 19.4 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
The localized name of the screen.
Example
MessageBox NSScreenMBS.firstScreen.localizedName

Either uses on MacOS 10.15 the value Apple frameworks provides.
Or returns name from plugin, either "Main Screen" or "Screen " plus index, so second screen is "Screen 2".
(Read only property)

NSScreenMBS.userSpaceScaleFactor as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the scaling factor from user space to device space on the screen represented by the receiver.
Example
Msgbox str(NSScreenMBS.mainScreen.userSpaceScaleFactor)

Returns the scaling factor, measured in pixels per point, where a point is always equal to 1/72 of an inch. For example, a scaling factor of 2.0 indicates the display has a resolution 2 pixels per point or 144 pixels-per-inch.

Available in Mac OS X v10.4 and later.
(Read only property)

NSScreenMBS.visibleFrame as NSRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns the current location and dimensions of the visible screen.
Example
Dim screens() As NSScreenMBS = NSScreenMBS.screens

// shows coordinates for each screen.
For Each Screen As NSScreenMBS In screens
MsgBox Screen.visibleFrame.String
Next

The returned rectangle is always based on the current user-interface settings and does not include the area currently occupied by the dock and menu bar. Because it is based on the current user -interface settings, the returned rectangle can change between calls and should not be cached.

Note: Even when dock hiding is enabled, the rectangle returned by this method may be smaller than the full screen. The system uses a small boundary area to determine when it should display the dock.
(Read only property)

Some examples using this property:

The items on this page are in the following plugins: MBS MacBase Plugin.


The biggest plugin in space...