Solved

VCL Bug???

Posted on 2001-08-15
6
283 Views
Last Modified: 2010-05-18
try this code:
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
   Label1.Caption:='down';
   Image1.Cursor:=crHandPoint;
end;

result:
Label1.caption changed immediately,but Image1.Cursor changed after Image1MouseUp event,why???bug???

How to Change Cursor immediately???
0
Comment
Question by:sundayboys
6 Comments
 

Expert Comment

by:comptebidon81
Comment Utility
There has to be an OnMouseOver event in order for your programm to detect that te mouse is currently over the Image. You could try to use Screen.Cursor := crHandPoint and set the last cursor back after. This will take effect immediately.

GunDamn
0
 
LVL 3

Expert Comment

by:rondi
Comment Utility

Try repainting the image/cursor ?
0
 
LVL 33

Expert Comment

by:Slick812
Comment Utility
I've had some sucess with other controls by calling Appication.ProcessMessages right after the "Control1.Cursor := crHandPoint" , don't remember trying it on a TImage.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 4

Accepted Solution

by:
DMN earned 30 total points
Comment Utility
You can use Screen.Cursor instead of Image1.Cursor:

procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Label1.Caption:='down';
  Screen.Cursor:=crHandPoint;
end;
0
 
LVL 21

Expert Comment

by:gemarti
Comment Utility
Well your question really is why is this happening and is it a bug right?

I don't think it is a bug. You see the OnMouseDown event for the Image object  is receiving the event, thus it is the handler. Before it's property (Cursor) can be changed the memory must be flushed and replaced with the updated property values.

I think this is why you don't actually see the cursor change until you release the mouse button. Once you release the mouse button the component is no longer receiving a WM_MOUSEDOWN Message and it can therefore update it's memory.

Probably not the most technical explaination...but this is what is happening.

Your other question was answered. To change the cursor immediately you should do so in an OnMouseMove event.

GEM
0
 
LVL 12

Expert Comment

by:rwilson032697
Comment Utility
You can force the cursor to change immeditately by doing this:

var
  CPos : TPoint;

...

  // Force cursor change
  GetCursorPos(CPos);
  SetCursorPos(CPos.X, CPos.y);

Cheers,

Raymond.
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

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…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 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

6 Experts available now in Live!

Get 1:1 Help Now