Platforms to show: All Mac Windows Linux Cross-Platform

NSCursorMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Cocoa MBS MacCocoa Plugin 8.6 Yes No No Yes, macOS only No
Function: Instances of the NSCursor class manage the appearance of the cursor.
Dim im As NSImageMBS
Dim p As Picture
Dim m As Picture
Dim theCursor As NSCursorMBS
Dim test As Boolean

// create a blue ball picture
p = New Picture(16,16,32)
p.Graphics.ForeColor = &c0000FF
p.Graphics.FillRect 0,0,16,16

m = New Picture(16,16,32)
m.Graphics.ForeColor = &c000000
m.Graphics.Filloval 0,0,16,16

// Create a new NSImage
im=New NSImageMBS(p,m)

// Create a cursor from the NSImage
theCursor=New NSCursorMBS(im, 10, 10)

Title = Str(theCursor.Handle)

// Make this the active cursor

// display picture
p.Mask.Graphics.DrawPicture m,0,0
Backdrop = p

// so you see it for a second before RB resets the cursor
DelayMBS 1.0
In Cocoa, you can change the currently displayed cursor based on the position of the mouse over one of your views. You might use this technique to provide visual feedback about what actions the user can take with the mouse. For example, you might display one of the resize cursors whenever the mouse moves over a portion of your view that acts as a custom resizing handle. To set this up, you associate a cursor object with one or more cursor rectangles in the view.

Cursor rectangles are a specialized type of tracking rectangles, which are used to monitor the mouse location in a view. Views implement cursor rectangles using tracking rectangles but provide methods for setting and refreshing cursor rectangles that are distinct from the generic tracking rectangle interface. For information on how to set up cursor rectangles, see "Handling Tracking-Rectangle and Cursor-Update Events in Views".

Feedback, Comments & Corrections

This class has no sub classes.

Some properties using for this class:

Some examples which use this class:

Blog Entries

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

NSControlMBS   -   NSCustomTouchBarItemMBS

The biggest plugin in space...

MBS Xojo blog