• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 297
  • Last Modified:

VCL Bug???

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
sundayboys
Asked:
sundayboys
1 Solution
 
comptebidon81Commented:
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
 
rondiCommented:

Try repainting the image/cursor ?
0
 
Slick812Commented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
DMNCommented:
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
 
gemartiCommented:
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
 
rwilson032697Commented:
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 Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now