New topic: 

Custom cursor, how do I use Constructor?

<http://forums.realsoftware.com/viewtopic.php?t=38358>

         Page 1 of 1
   [ 6 posts ]                 Previous topic | Next topic          Author  
Message        Lennart          Post subject: Custom cursor, how do I use 
Constructor?Posted: Mon Mar 28, 2011 8:03 am                                 
Joined: Sat Apr 29, 2006 10:13 am
Posts: 227
Location: Sweden                Hi,
I'm trying to get the hang on how to use the recommended method to use custom 
mouse cursors.
My application has 17 windows and I made a picture, MyImage.gif: 16x16 pixels 
in black, white and transparent.
I want this pointer for all my windows, so I figure it would be enough with 
code in App (?).

The documentation says Quote:MouseCursor.Constructor(image as Picture, xHotSpot 
as Integer, yHotSpot as Integer)

The preferred way to create a custom cursor is to use the constructor. Simply 
create an image of the cursor and add it to the project file. Pass it to the 
constructor with the coordinates of the x,y hotspot. The latter is the point 
used to track the location of the cursor. So, I dragged the MyImage into the 
Project tab.
Then, in tab App, I Add Method which I name Constructor.
In that Constructor code and Parameters I should put ...what exactly (with 
hotspot at 0,0)?
Or am I up the wrong alley?
Please help.
Thanks
Lennart   
                             Top                DaveS          Post subject: 
Re: Custom cursor, how do I use Constructor?Posted: Mon Mar 28, 2011 8:09 am    
                             
Joined: Sun Aug 05, 2007 10:46 am
Posts: 2882
Location: San Diego, CA                You can create 16x16 B&W cursors using a 
simple XML file.... at least for OSX..

Else where on this forum is a topic about exactly that. along with a link to a 
freeware little cursor editor to create the XML for you....
It was based on code I wrote, and then enhanced by someone else (and dang I 
forget who that was sorry)...      
_________________
Dave Sisemore
MacPro, OSX 10.6.4 RB2009r5.1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                Lennart          Post subject: 
Re: Custom cursor, how do I use Constructor?Posted: Mon Mar 28, 2011 8:28 am    
                             
Joined: Sat Apr 29, 2006 10:13 am
Posts: 227
Location: Sweden                Thanks, I have seen that am trying it. Very 
nice and generous freeware.
However, some issues make me want to compare that method with the now 
recommended method, i.e. using a constructor.
Therefore I ask about that method.   
                             Top                jefftullin          Post 
subject: Re: Custom cursor, how do I use Constructor?Posted: Mon Mar 28, 2011 
8:46 am                                 
Joined: Wed Nov 15, 2006 3:50 pm
Posts: 2223
Location: England                Im guessing :

 if you declare a mousecursor variable named FunnyPointer, you need to call

FunnyPointer = new MousePointer(theimportedimage, 13,12)

But this isnt really cross platform yet..I seem to recall reading that color 
cursors for example only 'work'  (but I havent actually tested this) under 
Cocoa.

Since you only need 16 x 16 B&W cursors, you may as well stick with the XML 
route for now.   
                             Top                doofus          Post subject: 
Re: Custom cursor, how do I use Constructor?Posted: Mon Mar 28, 2011 9:02 am    
                             
Joined: Thu Sep 10, 2009 2:50 am
Posts: 90
Location: Santa Cruz, CA, USA                Lennart wrote:Thanks, I have seen 
that am trying it. Very nice and generous freeware.
However, some issues make me want to compare that method with the now 
recommended method, i.e. using a constructor.
Therefore I ask about that method.

In the docs when it says "The preferred way to create a custom cursor is to use 
the constructor." it means the constructor method that's already part of the 
MouseCursor class; you don't need to make a 'Constructor' method.

I don't have this feature to test but I think it'd look like this for an app 
wide cursor...

//in App.Open event
dim mc As MouseCursor = new MouseCursor(MyImage, xspot, yspot)
self.MouseCursor = mc

"new MouseCursor" invokes the constructor method with (MyImage, xspot, yspot) 
as it's parameters.   
                             Top                 Lennart          Post subject: 
Re: Custom cursor, how do I use Constructor?Posted: Mon Mar 28, 2011 1:32 pm    
                             
Joined: Sat Apr 29, 2006 10:13 am
Posts: 227
Location: Sweden                Thanks for the explanation.
And it works as you thought -in Windows.
I guess it is not expected to work under Linux yet.

I wanted to compare the MouseCursor.Constructor way with the XML way, since I 
have a problem that I initially thought was with XML in Linux.
But I will start a new thread about that in the Linux forum "Is MouseCursor 
supposed to work in Linux?"
viewtopic.php?f=8&t=38365   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 6 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to