MG: fixed mouse coords on scrolling wincontrols

git-svn-id: trunk@3597 -
This commit is contained in:
lazarus 2002-11-01 14:40:31 +00:00
parent 678e5f14c0
commit 28eaade3c2
2 changed files with 22 additions and 3 deletions

View File

@ -123,6 +123,7 @@ type
Protected Protected
procedure AlignControls(AControl: TControl; var ARect: TRect); override; procedure AlignControls(AControl: TControl; var ARect: TRect); override;
procedure CreateWnd; override; procedure CreateWnd; override;
function GetChildsRect(Scrolled: boolean): TRect; override;
Procedure WMEraseBkgnd(var Message: TLMEraseBkgnd); message LM_ERASEBKGND; Procedure WMEraseBkgnd(var Message: TLMEraseBkgnd); message LM_ERASEBKGND;
procedure WMPaint(var message: TLMPaint); message LM_PAINT; procedure WMPaint(var message: TLMPaint); message LM_PAINT;
procedure WMSize(var Message: TLMSize); message LM_Size; procedure WMSize(var Message: TLMSize); message LM_Size;
@ -142,8 +143,10 @@ type
property Canvas: TControlCanvas read FCanvas; property Canvas: TControlCanvas read FCanvas;
published published
property AutoScroll: Boolean read FAutoScroll write SetAutoScroll; property AutoScroll: Boolean read FAutoScroll write SetAutoScroll;
property HorzScrollBar: TControlScrollBar read FHorzScrollBar write SetHorzScrollBar stored StoreScrollBars; property HorzScrollBar: TControlScrollBar
property VertScrollBar: TControlScrollBar read FVertScrollBar write SetVertScrollBar stored StoreScrollBars; read FHorzScrollBar write SetHorzScrollBar stored StoreScrollBars;
property VertScrollBar: TControlScrollBar
read FVertScrollBar write SetVertScrollBar stored StoreScrollBars;
end; end;
TScrollBox = class(TScrollingWinControl) TScrollBox = class(TScrollingWinControl)
@ -155,7 +158,8 @@ type
property AutoSize default True; property AutoSize default True;
//property AutoScroll; //property AutoScroll;
//property BiDiMode; //property BiDiMode;
//property BorderStyle: TBorderStyle read FBorderStyle write SetBorderStyle default bsSingle; //property BorderStyle: TBorderStyle
// read FBorderStyle write SetBorderStyle default bsSingle;
property Constraints; property Constraints;
//property DockSite; //property DockSite;
property DragCursor; property DragCursor;

View File

@ -335,6 +335,21 @@ begin
UpdateScrollBars; UpdateScrollBars;
end; end;
function TScrollingWinControl.GetChildsRect(Scrolled: boolean): TRect;
var
ScrolledX, ScrolledY: integer;
begin
Result:=inherited GetChildsRect(Scrolled);
if Scrolled then begin
ScrolledX:=HorzScrollBar.Position;
ScrolledY:=VertScrollBar.Position;
dec(Result.Left,ScrolledX);
dec(Result.Top,ScrolledY);
dec(Result.Right,ScrolledX);
dec(Result.Bottom,ScrolledY);
end;
end;
procedure TScrollingWinControl.AlignControls(AControl: TControl; var ARect: TRect); procedure TScrollingWinControl.AlignControls(AControl: TControl; var ARect: TRect);
begin begin
HorzScrollBar.AutoCalcRange; HorzScrollBar.AutoCalcRange;