[MBS] Re: NSCursor from a Picture (MBS REALbasic Plugin Mailinglist archive)

Back to the thread list
Previous thread: [MBS] Let's talk about pricing a new plugin
Next thread: [MBS] Re: Mbsplugins monkeybreadsoftware.info Digest, Vol 274, Issue 4


Re: [MBS] Extra PrefItems?   -   Garth Hjelte
  [MBS] Re: NSCursor from a Picture   -   Ron Benditt
    [MBS] NSCursor from a Picture   -   Ron Benditt
     Re: [MBS] NSCursor from a Picture   -   Christian Schmitz

[MBS] Re: NSCursor from a Picture
Date: 04.03.10 06:31 (Wed, 3 Mar 2010 21:31:26 -0800)
From: Ron Benditt
Ok, I've discovered why the Ring Cursors didn't seem to work. For some reason they are getting clipped to 16x16 pixels. When I put a DelayMBS call after the cursor is set, I can see that the smaller ring cursor (Ring Cursor 10) gets partially drawn. When I try the larger one, I see nothing at all. My theory is that it is getting clipped in the 16 pixel square at its corner, so you won't see anything drawn. But the Disappearing Item cursor is certainly bigger than 16x16 and it displays with no problems.

So the clipping and the automatic resetting back to the arrow are big show stoppers for me with this.

Regards,

Ron Benditt
Alien Apparatus Company, Inc.
http://www.alienapparatus.com

_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

[MBS] NSCursor from a Picture
Date: 04.03.10 00:19 (Wed, 3 Mar 2010 15:19:11 -0800)
From: Ron Benditt
I'm trying out the NSCursor class, trying to set the cursor to a REALbasic picture and I can't seem to get it to work. This is what I'm doing:

Dim im As NSImageMBS
Dim p As Picture
Dim m As Picture
Dim theCursor As NSCursorMBS
Dim test As Boolean

pyPicture
maPicturesMask

// Create a new NSImage
imnw NSImageMBS

// Initialize the image with a REALbasic picture and mask
testp.initWithPicture(p,m)

If test then

// Create a cursor from the NSImage
theCursorow NSCursorMBS(im, 10, 10)

// Make this the active cursor
theCursor.set

End If

When I run this, I don't get any errors but the cursor doesn't change either. The variable Test is true, so it looks like the NSImage was created. Am I doing something wrong? Are their restrictions on the pictures that can be used, such as size restrictions?

Also, the documentation on NSCursor.Image has a note at the bottom saying that you can't set this property. It says "Instead, use initWithImage:hotSpot: to create a new cursor with the new settings." The NSCursorMBS class does not appear to have an initWithImage method unless it was something that has just lately been added.

Regards,

Ron Benditt
Alien Apparatus Company, Inc.
http://www.alienapparatus.com

_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] NSCursor from a Picture
Date: 04.03.10 00:26 (Thu, 4 Mar 2010 00:26:43 +0100)
From: Christian Schmitz

Am 04.03.2010 um 00:19 schrieb Ron Benditt:

> I'm trying out the NSCursor class, trying to set the cursor to a REALbasic picture and I can't seem to get it to work. This is what I'm doing:

This code works:

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 1ewPicture(16,16,32)
p.Graphics.ForeColor c0000FF
p.Graphics.FillRect 0,0,16,16

m bewPicture(16,16,32)
m.Graphics.ForeColor nc000000
m.Graphics.Filloval 0,0,16,16

// Create a new NSImage
im>w NSImageMBS(p,m)

// Create a cursor from the NSImage
theCursor>w NSCursorMBS(im, 10, 10)

Title tr(theCursor.Handle)

// Make this the active cursor
theCursor.set

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

// so you see it for a second before RB resets the cursor
DelayMBS 1.0

except that RB resets the cursor right after the delay :-(

Greetings
Christian





Links
MBS Realbasic PDF Plugins - Pfarrgemeinde Messdiener Nickenich