Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using a custom cursor with a RES file

Posted on 1998-10-21
7
Medium Priority
?
185 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 150 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

604 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