Board index » delphi » Loading a CUSTOM cursor?

Loading a CUSTOM cursor?

I want to be able to load a custom cursor when a user moves the mouse over the
buttons on the form.

I used the image editor to create the resource file(.RES), then included the
right directives, API calls, etc., and cannot figure out how to complete the
cursor change.

Below is the code added:

In the Interface section:
 const
   PointingHandCursor = 2;

In the Implementation section: (The CURSOR1.RES file exists in the dir below)
{$R C:\SIGNBASE\CURSOR1.RES}

In the Form's FormCreate handler:

{Load custom Pointing Hand Cursor}
Screen.Cursors[PointingHandCursor] := LoadCursor(HInstance, 'CURSOR_1');

Then if I am not mistaken, the code to change the cursor would be to address
the Cursor property:

Cursor := PointingHandCursor;

Problem is where do you add the code to detect when the mouse is over a
Speedbutton on the form?  And in the method above correct?

Thanks a bunch!

----
RKR

****************************************
E-Mail:  r...@primenet.com
****************************************

 

Re:Loading a CUSTOM cursor?


On 14 Sep 1996 09:15:02 -0700, r...@primenet.com wrote:

Quote
>I want to be able to load a custom cursor when a user moves the mouse over the
>buttons on the form.

[ loading a custom cursor ]

Quote

>Problem is where do you add the code to detect when the mouse is over a
>Speedbutton on the form?  And in the method above correct?

Set the speed button's Cursor property to 2 (your constant for
PointingHandCursor) at design time.

If you really want to be adverturesome, you can write a new property
editor that looks for constant declarations in the source code and
lets the user choose a literal name instead of entering the ordinal
value...
--
Ray Lischner, Tempest Software, Corvallis, Oregon, USA
Author of Secrets of Delphi 2 (http://www.tempest-sw.com/secrets/)

Other Threads