sundayboys
asked on
VCL Bug???
try this code:
procedure TForm1.Image1MouseDown(Sen der: 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???
procedure TForm1.Image1MouseDown(Sen
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???
Try repainting the image/cursor ?
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
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.
var
CPos : TPoint;
...
// Force cursor change
GetCursorPos(CPos);
SetCursorPos(CPos.X, CPos.y);
Cheers,
Raymond.
GunDamn