Changeset 447 for trunk/Packages/CevoComponents/ButtonBase.pas
- Timestamp:
- May 19, 2022, 10:39:34 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CevoComponents/ButtonBase.pas
r431 r447 15 15 ClickProc: TNotifyEvent; 16 16 DownChangedProc: TNotifyEvent; 17 procedure SetDown( x: boolean);17 procedure SetDown(X: Boolean); 18 18 // procedure PlayDownSound; 19 19 // procedure PlayUpSound; 20 20 procedure MouseDown(Button: TMouseButton; Shift: TShiftState; 21 x, y: integer); override;21 X, Y: Integer); override; 22 22 procedure MouseUp(Button: TMouseButton; Shift: TShiftState; 23 x, y: integer); override;24 procedure MouseMove(Shift: TShiftState; x, y: integer); override;23 X, Y: Integer); override; 24 procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; 25 25 private 26 Active: boolean;26 Active: Boolean; 27 27 public 28 28 constructor Create(aOwner: TComponent); override; … … 32 32 published 33 33 property Visible; 34 property Down: boolean read FDown write SetDown;35 property Permanent: boolean read FPermanent write FPermanent;34 property Down: Boolean read FDown write SetDown; 35 property Permanent: Boolean read FPermanent write FPermanent; 36 36 property OnClick: TNotifyEvent read ClickProc write ClickProc; 37 37 property OnDownChanged: TNotifyEvent read DownChangedProc … … 50 50 // FUpSound:=''; 51 51 FGraphic := nil; 52 Active := false;53 FDown := false;54 FPermanent := false;52 Active := False; 53 FDown := False; 54 FPermanent := False; 55 55 ClickProc := nil; 56 56 end; 57 57 58 58 procedure TButtonBase.MouseDown(Button: TMouseButton; Shift: TShiftState; 59 x, y: integer);59 X, Y: Integer); 60 60 begin 61 Active := true;62 MouseMove(Shift, x, y);61 Active := True; 62 MouseMove(Shift, X, Y); 63 63 end; 64 64 65 65 procedure TButtonBase.MouseUp(Button: TMouseButton; Shift: TShiftState; 66 x, y: integer);66 X, Y: Integer); 67 67 begin 68 68 if ssLeft in Shift then 69 exit;70 MouseMove(Shift, x, y);69 Exit; 70 MouseMove(Shift, X, Y); 71 71 if Active and FDown then 72 72 begin 73 73 // PlayUpSound; 74 Active := false;74 Active := False; 75 75 if FDown <> FPermanent then 76 76 begin … … 86 86 begin 87 87 // if FDown then PlayUpSound; 88 Active := false;88 Active := False; 89 89 if FDown then 90 90 begin 91 FDown := false;91 FDown := False; 92 92 Invalidate; 93 93 if @DownChangedProc <> nil then … … 97 97 end; 98 98 99 procedure TButtonBase.MouseMove(Shift: TShiftState; x, y: integer);99 procedure TButtonBase.MouseMove(Shift: TShiftState; X, Y: Integer); 100 100 begin 101 101 if Active then 102 if ( x >= 0) and (x < Width) and (y >= 0) and (y< Height) then102 if (X >= 0) and (X < Width) and (Y >= 0) and (Y < Height) then 103 103 if (ssLeft in Shift) and not FDown then 104 104 begin 105 105 { PlayDownSound; } 106 FDown := true;106 FDown := True; 107 107 Paint; 108 108 if @DownChangedProc <> nil then … … 113 113 begin 114 114 { PlayUpSound; } 115 FDown := false;115 FDown := False; 116 116 Paint; 117 117 if @DownChangedProc <> nil then … … 120 120 end; 121 121 122 procedure TButtonBase.SetDown( x: boolean);122 procedure TButtonBase.SetDown(X: Boolean); 123 123 begin 124 FDown := x;124 FDown := X; 125 125 Invalidate; 126 126 end;
Note:
See TracChangeset
for help on using the changeset viewer.