Dans l'unité "Controls" de Lazarus il y a :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
type
  { TMouse }
 
  TMouse = class
  private
    FCapture: HWND;
    FWheelScrollLines: Integer;
    procedure SetCapture(const Value: HWND);
    function GetCapture: HWND;
    function GetCursorPos: TPoint;
    function GetIsDragging: Boolean;
    procedure SetCursorPos(AValue: TPoint);
    function GetWheelScrollLines: Integer;
    function GetDragImmediate: Boolean;
    procedure SetDragImmediate(const AValue: Boolean);
    function GetDragThreshold: Integer;
    procedure SetDragThreshold(const AValue: Integer);
  public
    property Capture: HWND read GetCapture write SetCapture;
    property CursorPos: TPoint read GetCursorPos write SetCursorPos;
    property IsDragging: Boolean read GetIsDragging;
    property WheelScrollLines: Integer read GetWheelScrollLines;
    property DragImmediate: Boolean read GetDragImmediate write SetDragImmediate;
    property DragThreshold: Integer read GetDragThreshold write SetDragThreshold;
  end;
 
...
 
var
 ...
  Mouse: TMouse;
Dans mon programme, j'écris :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
    Mouse.CursorPos.X:= X-16;
    Mouse.CursorPos.Y:= Y;
Je me fais jeter à la compilation avec le message :

unit1.pas(104,19) Error: Argument can't be assigned to
unit1.pas(105,19) Error: Argument can't be assigned to


Je n'en vois pas la raison car la propriété "CursorPos" possède un "read" et un "write".

Un idée du pourquoi du comment ???

Comment faites-vous pour déplacer la souris par programme ?

Merci de votre aide.

Pierre