Solved

Using a custom cursor with a RES file

Posted on 1998-10-21
7
171 Views
Last Modified: 2010-04-06
I have a customer cursor in a RES file.  The cursor is called CURSOR_1

If I am using Delphi 1, how do I assign this custom cursor to a TLabel, so that when the mouse is over the TLabel, the cursor will switch to the CURSOR_1 cursor?

In short, I am trying to create a fake URL link with a TLabel and Font style Underline.  The custom cursor is a  finger pointer cursor.

I understand that I must bind the RES file to my Main form...

implementation
{$R *.DFM}
{$R MYRESRC.RES}

...then what?
0
Comment
Question by:Kapusta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 50 total points
ID: 1343837
Use the cursor property of the TLabel..

eg:

const
  MyCusorIdx = 1000;

MyLabel.Cursor := Screen.Cursors[MyCusorIdx];

You can add the cursor to screen.cursors like this:

Screen.Cursors[MyCusorIdx] := LoadCursor(HInstance, MakeIntResource(MyCusorIdx);

(Oh, this needs the cursor to be named as the cursor number, eg '1000' - this is how we do it, you could replace Makeintresource() with the name of your cursor 'CURSOR_1').

Cheers,

Raymond
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1343838
It just struck me that you are making a component for a URL... There are also some freeware ones on the DSP

http://sunsite.icm.edu.pl/delphi/

Cheers,

Raymond.
0
 

Author Comment

by:Kapusta
ID: 1343839
I have done what you said, and it does not work.  I have renamed my cursor in my RES file from 'CURSOR_1' to '1000'

procedure TForm1.FormCreate(Sender: TObject);
begin
Screen.Cursors[1000] := LoadCursor(HInstance, '1000');
Label1.Cursor := Screen.Cursors[1000];

I have then performed a "Build All", and recompiled, and yet when the mouse is over top of the Label1 component at run time, the custom cursor is NOT displayed.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:viktornet
ID: 1343840
Hello guys,....

Try this one...

{$R Whatever.res}

const
  crMyCur = 1;

procedure TForm1.WhateverFormCreate(Sender : TObject);
begin
  Screen.Cursors[crMyCur] := LoadCursor(HInstance, 'CURSOR_1');
  Label1.Cursor := crMyCur;
end;

Hope this helps.....

Cheers,
Viktor
0
 

Author Comment

by:Kapusta
ID: 1343841
Thanks Victornet...your clarification fixed the problem.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1343842
Any time ;->

Cheers,
Viktor
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1343843
I really have to start compiling the code I write, sigh :-(

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi: how to implement a User Shortcut mapper? 1 138
How to convert memory stream to PDF file 6 187
DBGrid or StringGrid ? 6 120
How to make Sign in, using Clientdataset? 1 33
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question