diff --git a/lcl/controls.pp b/lcl/controls.pp
index 6b33336..6df22af 100644
--- a/lcl/controls.pp
+++ b/lcl/controls.pp
@@ -692,31 +692,21 @@ type
   TControlBorderSpacing = class(TPersistent)
   private
     FAround: TSpacingSize;
-    FBottom: TSpacingSize;
     FCellAlignHorizontal: TControlCellAlign;
     FCellAlignVertical: TControlCellAlign;
     FControl: TControl;
     FInnerBorder: Integer;
-    FLeft: TSpacingSize;
     FOnChange: TNotifyEvent;
-    FRight: TSpacingSize;
-    FTop: TSpacingSize;
+    FSides: array [TAnchorKind] of TSpacingSize;
     FDefault: PControlBorderSpacingDefault;
     function IsAroundStored: boolean;
-    function IsBottomStored: boolean;
     function IsInnerBorderStored: boolean;
-    function IsLeftStored: boolean;
-    function IsRightStored: boolean;
-    function IsTopStored: boolean;
+    function IsSideStored(Kind: TAnchorKind): boolean;
     procedure SetAround(const AValue: TSpacingSize);
-    procedure SetBottom(const AValue: TSpacingSize);
     procedure SetCellAlignHorizontal(const AValue: TControlCellAlign);
     procedure SetCellAlignVertical(const AValue: TControlCellAlign);
     procedure SetInnerBorder(const AValue: Integer);
-    procedure SetLeft(const AValue: TSpacingSize);
-    procedure SetRight(const AValue: TSpacingSize);
     procedure SetSpace(Kind: TAnchorKind; const AValue: integer);
-    procedure SetTop(const AValue: TSpacingSize);
   protected
     procedure Change(InnerSpaceChanged: Boolean); virtual;
   public
@@ -724,18 +714,18 @@ type
     procedure Assign(Source: TPersistent); override;
     procedure AssignTo(Dest: TPersistent); override;
     function IsEqual(Spacing: TControlBorderSpacing): boolean;
-    procedure GetSpaceAround(var SpaceAround: TRect);
-    function GetSideSpace(Kind: TAnchorKind): Integer; // Around+GetSpace
-    function GetSpace(Kind: TAnchorKind): Integer;
+    procedure GetSpaceAround(out SpaceAround: TRect); virtual;
+    function GetSideSpace(Kind: TAnchorKind): Integer; virtual; // Around+GetSpace
+    function GetSpace(Kind: TAnchorKind): TSpacingSize;
   public
     property Control: TControl read FControl;
-    property Space[Kind: TAnchorKind]: integer read GetSpace write SetSpace;
+    property Space[Kind: TAnchorKind]: TSpacingSize read GetSpace write SetSpace;
   published
     property OnChange: TNotifyEvent read FOnChange write FOnChange;
-    property Left: TSpacingSize read FLeft write SetLeft stored IsLeftStored;
-    property Top: TSpacingSize read FTop write SetTop stored IsTopStored;
-    property Right: TSpacingSize read FRight write SetRight stored IsRightStored;
-    property Bottom: TSpacingSize read FBottom write SetBottom stored IsBottomStored;
+    property Left: TSpacingSize index akLeft read FSides[akLeft] write SetSpace stored IsSideStored;
+    property Top: TSpacingSize index akTop read FSides[akTop] write SetSpace stored IsSideStored;
+    property Right: TSpacingSize index akRight read FSides[akRight] write SetSpace stored IsSideStored;
+    property Bottom: TSpacingSize index akBottom read FSides[akBottom] write SetSpace stored IsSideStored;
     property Around: TSpacingSize read FAround write SetAround stored IsAroundStored;
     property InnerBorder: Integer read FInnerBorder write SetInnerBorder stored IsInnerBorderStored default 0;
     property CellAlignHorizontal: TControlCellAlign read FCellAlignHorizontal write SetCellAlignHorizontal default ccaFill;
@@ -3240,13 +3230,6 @@ begin
   else Result := FAround <> FDefault^.Around;
 end;
 
-function TControlBorderSpacing.IsBottomStored: boolean;
-begin
-  if FDefault = nil
-  then Result := FBottom <> 0
-  else Result := FBottom <> FDefault^.Bottom;
-end;
-
 function TControlBorderSpacing.IsInnerBorderStored: boolean;
 begin
   if Control <> nil then
@@ -3255,32 +3238,21 @@ begin
     Result:=True;
 end;
 
-function TControlBorderSpacing.IsLeftStored: boolean;
-begin
-  if FDefault = nil
-  then Result := FLeft <> 0
-  else Result := FLeft <> FDefault^.Left;
-end;
-
-function TControlBorderSpacing.IsRightStored: boolean;
-begin
-  if FDefault = nil
-  then Result := FRight <> 0
-  else Result := FRight <> FDefault^.Right;
-end;
-
-function TControlBorderSpacing.IsTopStored: boolean;
+function TControlBorderSpacing.IsSideStored(Kind: TAnchorKind): boolean;
+var
+  DefaultValue: TSpacingSize;
 begin
   if FDefault = nil
-  then Result := FTop <> 0
-  else Result := FTop <> FDefault^.Top;
-end;
-
-procedure TControlBorderSpacing.SetBottom(const AValue: TSpacingSize);
-begin
-  if FBottom=AValue then exit;
-  FBottom:=AValue;
-  Change(false);
+  then Result := FSides[Kind] <> 0
+  else begin
+    case Kind of
+      akLeft: DefaultValue := FDefault^.Left;
+      akTop: DefaultValue := FDefault^.Top;
+      akRight: DefaultValue := FDefault^.Right;
+      akBottom: DefaultValue := FDefault^.Bottom;
+    end;
+    Result := FSides[Kind] <> DefaultValue;
+  end;
 end;
 
 procedure TControlBorderSpacing.SetCellAlignHorizontal(
@@ -3307,35 +3279,11 @@ begin
   Change(true);
 end;
 
-procedure TControlBorderSpacing.SetLeft(const AValue: TSpacingSize);
-begin
-  if FLeft=AValue then exit;
-  FLeft:=AValue;
-  Change(false);
-end;
-
-procedure TControlBorderSpacing.SetRight(const AValue: TSpacingSize);
-begin
-  if FRight=AValue then exit;
-  FRight:=AValue;
-  Change(false);
-end;
-
 procedure TControlBorderSpacing.SetSpace(Kind: TAnchorKind;
   const AValue: integer);
 begin
-  case Kind of
-  akLeft: Left:=AValue;
-  akTop: Top:=AValue;
-  akBottom: Bottom:=AValue;
-  akRight: Right:=AValue;
-  end;
-end;
-
-procedure TControlBorderSpacing.SetTop(const AValue: TSpacingSize);
-begin
-  if FTop=AValue then exit;
-  FTop:=AValue;
+  if FSides[Kind]=AValue then exit;
+  FSides[Kind]:=AValue;
   Change(false);
 end;
 
@@ -3345,10 +3293,10 @@ begin
   FDefault := ADefault;
   if ADefault <> nil then
   begin
-    FLeft := ADefault^.Left;
-    FRight := ADefault^.Right;
-    FTop := ADefault^.Top;
-    FBottom := ADefault^.Bottom;
+    FSides[akLeft] := ADefault^.Left;
+    FSides[akRight] := ADefault^.Right;
+    FSides[akTop] := ADefault^.Top;
+    FSides[akBottom] := ADefault^.Bottom;
     FAround := ADefault^.Around;
   end;
   FCellAlignHorizontal := ccaFill;
@@ -3365,15 +3313,15 @@ begin
     if IsEqual(SrcSpacing) then exit;
 
     FAround:=SrcSpacing.Around;
-    FBottom:=SrcSpacing.Bottom;
-    FLeft:=SrcSpacing.Left;
-    FRight:=SrcSpacing.Right;
-    FTop:=SrcSpacing.Top;
+    FSides[akBottom]:=SrcSpacing.Bottom;
+    FSides[akLeft]:=SrcSpacing.Left;
+    FSides[akRight]:=SrcSpacing.Right;
+    FSides[akTop]:=SrcSpacing.Top;
     FInnerBorder:=SrcSpacing.InnerBorder;
     FCellAlignHorizontal:=SrcSpacing.CellAlignHorizontal;
     FCellAlignVertical:=SrcSpacing.CellAlignVertical;
 
-    Change(false);
+    Change(True);
   end else
     inherited Assign(Source);
 end;
@@ -3387,13 +3335,13 @@ function TControlBorderSpacing.IsEqual(Spacing: TControlBorderSpacing
   ): boolean;
 begin
   Result:=(FAround=Spacing.Around)
-      and (FBottom=Spacing.Bottom)
-      and (FLeft=Spacing.Left)
-      and (FRight=Spacing.Right)
-      and (FTop=Spacing.Top);
+      and (Bottom=Spacing.Bottom)
+      and (Left=Spacing.Left)
+      and (Right=Spacing.Right)
+      and (Top=Spacing.Top);
 end;
 
-procedure TControlBorderSpacing.GetSpaceAround(var SpaceAround: TRect);
+procedure TControlBorderSpacing.GetSpaceAround(out SpaceAround: TRect);
 begin
   SpaceAround.Left:=Left+Around;
   SpaceAround.Top:=Top+Around;
@@ -3407,14 +3355,9 @@ begin
   Result:=Around+GetSpace(Kind);
 end;
 
-function TControlBorderSpacing.GetSpace(Kind: TAnchorKind): Integer;
+function TControlBorderSpacing.GetSpace(Kind: TAnchorKind): TSpacingSize;
 begin
-  case Kind of
-  akLeft: Result:=Left;
-  akTop: Result:=Top;
-  akRight: Result:=Right;
-  akBottom: Result:=Bottom;
-  end;
+  Result:=FSides[Kind];
 end;
 
 procedure TControlBorderSpacing.Change(InnerSpaceChanged: Boolean);
diff --git a/lcl/editbtn.pas b/lcl/editbtn.pas
index 4f3d284..86a4c0e 100644
--- a/lcl/editbtn.pas
+++ b/lcl/editbtn.pas
@@ -66,6 +66,7 @@ type
     procedure CheckButtonVisible;
     function CalcButtonVisible: boolean; virtual;
     function CalcButtonEnabled: Boolean; virtual;
+    function CreateControlBorderSpacing: TControlBorderSpacing; override;
     function GetReadOnly: Boolean; override;
     function GetDefaultGlyph: TBitmap; virtual;
     function GetDefaultGlyphName: String; virtual;
@@ -75,6 +76,7 @@ type
     procedure DoButtonClick (Sender: TObject); virtual;
     procedure Loaded; override;
     procedure Notification(AComponent: TComponent; Operation: TOperation); override;
+    procedure DoOnChangeBounds; override;
     procedure CMVisibleChanged(var Msg: TLMessage); message CM_VISIBLECHANGED;
     procedure CMEnabledChanged(var Msg: TLMessage); message CM_ENABLEDCHANGED;
     procedure CMBiDiModeChanged(var Message: TLMessage); message CM_BIDIMODECHANGED;
@@ -89,10 +91,20 @@ type
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
+    function ChildClassAllowed(ChildClass: TClass): boolean; override;
     property Flat: Boolean read GetFlat write SetFlat default False;
     property ButtonOnlyWhenFocused: Boolean read FButtonNeedsFocus write SetButtonNeedsFocus default False;
   end;
   
+  { TEditButtonSpacing }
+
+  TEditButtonSpacing = class(TControlBorderSpacing)
+  public
+    constructor Create(OwnerControl: TCustomEditButton);
+    procedure GetSpaceAround(out SpaceAround: TRect); override;
+    function GetSideSpace(Kind: TAnchorKind): Integer; override;
+  end;
+
   { TEditButton }
 
   TEditButton = class(TCustomEditButton)
@@ -630,7 +642,6 @@ procedure Register;
 
 implementation
 
-
 { TCustomEditButton }
 
 constructor TCustomEditButton.Create(AOwner: TComponent);
@@ -660,6 +671,11 @@ begin
   inherited Destroy;
 end;
 
+function TCustomEditButton.ChildClassAllowed(ChildClass: TClass): boolean;
+begin
+  Result := ChildClass = TSpeedButton;
+end;
+
 procedure TCustomEditButton.SetGlyph(Pic: TBitmap);
 Begin
   FButton.Glyph:=Pic;
@@ -763,6 +779,12 @@ begin
     FButton := nil;
 end;
 
+procedure TCustomEditButton.DoOnChangeBounds;
+begin
+  inherited;
+  DoPositionButton;
+end;
+
 procedure TCustomEditButton.CMVisibleChanged(var Msg: TLMessage);
 begin
   inherited CMVisibleChanged(Msg);
@@ -880,6 +902,11 @@ begin
   Result := not FIsReadOnly and Enabled;
 end;
 
+function TCustomEditButton.CreateControlBorderSpacing: TControlBorderSpacing;
+begin
+  Result := TEditButtonSpacing.Create(Self);
+end;
+
 procedure TCustomEditButton.SetReadOnly(AValue: Boolean);
 begin
   FIsReadOnly := AValue;
@@ -893,9 +920,9 @@ begin
   if FButton = nil then exit;
   FButton.Parent := Parent;
   if BiDiMode = bdLeftToRight then
-    FButton.AnchorToCompanion(akLeft,0,Self)
+    FButton.SetBounds(Left + Width, Top, Height, Height)
   else
-    FButton.AnchorToCompanion(akRight,0,Self);
+    FButton.SetBounds(0, Top, Height, Height);
 end;
 
 procedure TCustomEditButton.WMSetFocus(var Message: TLMSetFocus);
@@ -905,6 +932,35 @@ begin
 end;
 
 
+{ TEditButtonSpacing }
+
+constructor TEditButtonSpacing.Create(OwnerControl: TCustomEditButton);
+begin
+  inherited Create(OwnerControl);
+end;
+
+procedure TEditButtonSpacing.GetSpaceAround(out SpaceAround: TRect);
+begin
+  inherited GetSpaceAround(SpaceAround);
+  if BiDiMode = bdLeftToRight then
+    Inc(SpaceAround.Right, TCustomEditButton(Control).ButtonWidth)
+  else
+    Inc(SpaceAround.Left, TCustomEditButton(Control).ButtonWidth)
+end;
+
+function TEditButtonSpacing.GetSideSpace(Kind: TAnchorKind): Integer;
+begin
+  Result := inherited GetSideSpace(Kind);
+  if Kind = akRight and then
+  begin
+    if BiDiMode = bdLeftToRight then
+      Inc(Result, TCustomEditButton(Control).ButtonWidth);
+  end
+  else if Kind = akLeft and BiDiMode <> bdLeftToRight then
+    Inc(Result, TCustomEditButton(Control).ButtonWidth);
+end;
+
+
 { TCustomControlFilterEdit }
 
 constructor TCustomControlFilterEdit.Create(AOwner: TComponent);
