Changeset 13 for os/trunk/Xvcl
- Timestamp:
- Feb 29, 2016, 3:09:13 PM (9 years ago)
- Location:
- os/trunk/Xvcl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
os/trunk/Xvcl/Xvcl.Controls.pas
r8 r13 60 60 FOnMouseUp: TNotifyEvent; 61 61 FOnKeyPress: TNotifyEvent; 62 FFocused: Boolean; 62 63 function GetCanvas: TCanvas; 63 64 procedure SetParent(const Value: TWinControl); virtual; 64 65 procedure SetColor(const Value: TColor); 66 procedure SetFocused(const Value: Boolean); 65 67 protected 66 68 function GetVideoDevice: TVideoDevice; virtual; … … 79 81 property VideoDevice: TVideoDevice read GetVideoDevice; 80 82 property Color: TColor read FColor write SetColor; 83 property Focused: Boolean read FFocused write SetFocused; 81 84 property OnClick: TNotifyEvent read FOnClick write FOnClick; 82 85 property OnMouseDown: TNotifyEvent read FOnMouseDown write FOnMouseDown; … … 88 91 protected 89 92 function HandleMessage(Message: TMessage): Boolean; override; 93 private 94 procedure ClearFocus; 90 95 public 91 96 Controls: TList<TControl>; … … 193 198 if Visible then Paint; 194 199 end; 200 end; 201 202 procedure TControl.SetFocused(const Value: Boolean); 203 begin 204 if Value then FParent.ClearFocus; 205 FFocused := Value; 195 206 end; 196 207 … … 268 279 269 280 { TWinControl } 281 282 procedure TWinControl.ClearFocus; 283 var 284 Control: TControl; 285 begin 286 for Control in Controls do 287 Control.Focused := False; 288 end; 270 289 271 290 constructor TWinControl.Create; … … 342 361 begin 343 362 Result := False; 344 if Message is TMessageKeyPress then 363 if (Message is TMessageMouseDown) then 364 Focused := True 365 else 366 if (Message is TMessageKeyPress) and Focused then 345 367 with TMessageKeyPress(Message) do begin 346 368 if Assigned(FOnKeyPress) then FOnKeyPress(Self); -
os/trunk/Xvcl/Xvcl.Forms.pas
r5 r13 90 90 Move.StartMousePos := Position; 91 91 Move.Active := True; 92 Result := True;92 Result := True; 93 93 end; 94 94 end else … … 137 137 if FFocused <> Value then begin 138 138 FFocused := Value; 139 if Value then TScreen(Screen).Focus Form(Self);139 if Value then TScreen(Screen).FocusedForm := Self; 140 140 end; 141 141 end;
Note:
See TracChangeset
for help on using the changeset viewer.