Solved

Using a custom cursor with a RES file

Posted on 1998-10-21
7
163 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
  • 3
  • 2
  • 2
7 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 10

Expert Comment

by:viktornet
Comment Utility
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
Comment Utility
Thanks Victornet...your clarification fixed the problem.
0
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
Any time ;->

Cheers,
Viktor
0
 
LVL 12

Expert Comment

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

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now