for some reason The Align property of the control being docked back from where it came from gets changed to AlCLient instead of leaving it as was?
Following test code that implements a Button1.Click where the button itself is to float or dock back and forth, etc.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
Var
PT:TPoint;
RT:TRect;
begin
With Sender as Tbutton Do
Begin
If Floating then
Begin
PT := HostDockSite.ClientToScreen(Point(0,0));
RT := Self.ClientRect;
RT.Offset(Self.ClientToScreen(Point(0,0)));
IF RT.Contains(PT) Then
Begin
PT := Self.ScreenToClient(PT);
Dock(Self,TRect.Create(PT.X,PT.Y,Width+PT.X,Height+PT.Y));
Align := alNone; //Why must I do this ?
End;
end Else
Begin
RT := Self.ClientToScreen(BoundsRect);
RT.offset(0,-32); //good enought for now.
ManualFloat(RT);
end;
end;
end;
end.
Not sure where at what point the alignment gets changed but there is no way other than what I have shown here to change it before it gets repainted.
I am not using the Drag Drop system, I am doing manual floats and docks however, I've notice artifacts of full client shadow masking while using the dragging system, it maybe related.
Basically I move the floating control within the form area and then click the button again. Would be nice if I didn't have to do a hack like this? The other method of ManualDock does not fix this issue either.