diff --git a/lcl/comctrls.pp b/lcl/comctrls.pp index ca537283aa..44e0eede38 100644 --- a/lcl/comctrls.pp +++ b/lcl/comctrls.pp @@ -1402,6 +1402,7 @@ type procedure SetWrap(Value: Boolean); procedure SetMouseInControl(NewMouseInControl: Boolean); procedure CMEnabledChanged(var Message: TLMEssage); message CM_ENABLEDCHANGED; + procedure CMVisibleChanged(var Message: TLMessage); message CM_VISIBLECHANGED; procedure CMHitTest(var Message: TCMHitTest); message CM_HITTEST; protected FToolBar: TToolBar; diff --git a/lcl/include/toolbar.inc b/lcl/include/toolbar.inc index 126962af60..aa93aaf685 100644 --- a/lcl/include/toolbar.inc +++ b/lcl/include/toolbar.inc @@ -26,7 +26,7 @@ var Row2: Integer; HalfBtnHeight, BtnHeight: Integer; begin - Result:=0; + Result := 0; if not (Control1.Parent is TToolBar) then Exit; ToolBar := TToolBar(Control1.Parent); @@ -36,27 +36,14 @@ begin Row1 := (Control1.Top + HalfBtnHeight) div BtnHeight; Row2 := (Control2.Top + HalfBtnHeight) div BtnHeight; - if Row1 < Row2 then - Result := -1 - else - if Row1 > Row2 then - Result :=1 - else - if Control1.Left < Control2.Left then - Result := -1 - else - if Control1.Left > Control2.Left then - Result := 1 - else + Result := CompareValue(Row1, Row2); + if Result = 0 then + Result := CompareValue(Control1.Left, Control2.Left); + if Result = 0 then begin Row1 := ToolBar.GetControlIndex(Control1); Row2 := ToolBar.GetControlIndex(Control2); - // buttons order is reversed, iow last addeted button will be first - if Row1 < Row2 then - Result := 1 - else - if Row1 > Row2 then - Result := -1 + Result := CompareValue(Row1, Row2); end; end; @@ -580,11 +567,11 @@ begin StartX:=ARect.Left; x:=StartX; y:=ARect.Top; - i:=0; - while i nil then + RefreshControl; +end; + procedure TToolButton.BeginUpdate; begin Inc(FUpdateCount);