Hi attached patch repair calculation of visibility scrollbar Clicked on tButton now work for scrolled window
all under GTK+ Darek
Index: forms.pp =================================================================== --- forms.pp (wersja 9125) +++ forms.pp (kopia robocza) @@ -915,6 +915,8 @@ FAsyncCallQueue: PAsyncCallQueueItem; FShowHint: Boolean; FShowMainForm: Boolean; + FLastMousePos : TPoint; + FLastMouseControl : tControl; procedure DoOnIdleEnd; function GetCurrentHelpFile: string; function GetExename: String; Index: include/wincontrol.inc =================================================================== --- include/wincontrol.inc (wersja 9125) +++ include/wincontrol.inc (kopia robocza) @@ -1675,6 +1675,7 @@ AWinControl: TWinControl; begin if AutoSizeDelayed then exit; + disableAlign; for i:=0 to ControlCount-1 do begin Child:=Controls[i]; if Child.AutoSizeDelayed then continue; @@ -1691,6 +1692,7 @@ AWinControl.ReAlign; end; end; + EnableAlign; end; {------------------------------------------------------------------------------- @@ -2797,6 +2799,7 @@ function TWinControl.IsControlMouseMsg(var TheMessage: TLMMouse) : Boolean; var Control : TControl; + ScrolledOffset, P : TPoint; ClientBounds: TRect; begin @@ -2817,8 +2820,10 @@ if Control <> nil then begin // map mouse coordinates to control - P.X := TheMessage.XPos - Control.Left; - P.Y := TheMessage.YPos - Control.Top; + ScrolledOffset:=GetClientScrollOffset; + + P.X := TheMessage.XPos - Control.Left + ScrolledOffset.X; + P.Y := TheMessage.YPos - Control.Top + ScrolledOffset.Y; if (Control is TWinControl) and TWinControl(Control).HandleAllocated then begin // map coordinates to client area of control Index: include/controlscrollbar.inc =================================================================== --- include/controlscrollbar.inc (wersja 9125) +++ include/controlscrollbar.inc (kopia robocza) @@ -230,7 +230,6 @@ AutoCalcVRange else AutoCalcHRange; - ControlUpdateScrollBars; end; end; @@ -264,12 +263,13 @@ SBSize := OtherScrollbar.Size else SBSize := 0; - if Kind=sbVertical then - FAutoRange := (FRange - ClientHeight) - *Shortint(FRange >= ClientHeight + SBSize) - else - FAutoRange := (FRange - ClientWidth) - *Shortint(FRange >= ClientWidth + SBSize); + if Kind=sbVertical then begin + SBSize:=ClientHeight - SBSize; + end else begin + SBSize:=ClientWidth - SBSize; + end; + if (fRange>SBSize) and (SBSize>0) then FAutoRange := (FRange - SBSize) + else FAutoRange := 0; ScrollInfo.nMax := FRange; // visible Index: include/checkbox.inc =================================================================== --- include/checkbox.inc (wersja 9125) +++ include/checkbox.inc (kopia robocza) @@ -144,7 +144,7 @@ Procedure TCheckbox.WMKeyDown(var Message : TLMKeyDown); begin - ControlState := ControlState - [csClicked]; + Exclude(FControlState, csClicked); Case Message.CharCode of 32: begin Index: include/control.inc =================================================================== --- include/control.inc (wersja 9125) +++ include/control.inc (kopia robocza) @@ -1805,7 +1805,7 @@ if csClicked in ControlState then begin Exclude(FControlState, csClicked); - //DebugLn('TControl.WMLButtonUp B ',ClientRect.Left,',',ClientRect.Top,',',ClientRect.Right,',',ClientRect.Bottom,' ',Message.Pos.X,',',Message.Pos.Y); + //DebugLn('TControl.WMLButtonUp B ',dbgs(ClientRect.Left),',',dbgs(ClientRect.Top),',',dbgs(ClientRect.Right),',',dbgs(ClientRect.Bottom),' ',dbgs(Message.Pos.X),',',dbgs(Message.Pos.Y)); if PtInRect(ClientRect, SmallPointToPoint(Message.Pos)) then begin //DebugLn('TControl.WMLButtonUp C'); Index: include/application.inc =================================================================== --- include/application.inc (wersja 9125) +++ include/application.inc (kopia robocza) @@ -407,9 +407,15 @@ P: TPoint; begin GetCursorPos(P); - Result := FindControlAtPosition(P, True); + if (P.X=FLastMousePos.x) and (P.Y=FLastMousePos.Y) then Result:=FLastMouseControl + else Result := FindControlAtPosition(P, True); + if (Result <> nil) and (csDesigning in Result.ComponentState) then Result := nil; + if Result<> nil then begin + FLastMousePos:=p; + FLastMouseControl:=Result; + end; end; procedure TApplication.SetNavigation(const AValue: TApplicationNavigationOptions