I have a TFrame descendent that has on it a sizable panel which is a third-party component (TLMDSimplePanel)). The sizing on that panel works great, but I want the frame it is contained in to resize dynamically when the user changes the size of the panel. (The panel has a little sizing thumb grip on it that the user can just click and drag with the mouse).
The code for this frame is below:
unit SizeableFrame;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TcmBaseFrameFrame, LMDCustomControl, LMDCustomPanel, LMDCustomBevelPanel,
LMDSimplePanel, StdCtrls;
type
TcmSizeableFrame = class(TcmBaseFrame)
LMDSimplePanel1: TLMDSimplePanel;
Memo1: TMemo;
Memo2: TMemo;
procedure LMDSimplePanel1Resize(Sender: TObject);
procedure FrameCanResize(Sender: TObject; var NewWidth, NewHeight: Integer;
var Resize: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
cmSizeableFrame: TcmSizeableFrame;
implementation
{$R *.dfm}
procedure TcmSizeableFrame.FrameCanResize(Sender: TObject; var NewWidth,
NewHeight: Integer; var Resize: Boolean);
begin
inherited;
Resize := True;
end;
procedure TcmSizeableFrame.LMDSimplePanel1Resize(Sender: TObject);
const
ExpandByPixels = 60;
var
MyFrame : TFrame;
begin
inherited;
Self.Height := LMDSimplePanel1.Height + ExpandByPixels;
Self.Width := LMDSimplePanel1.Width + ExpandByPixels;
end;
end.
It works wonderfully, if the user is shrinking the the size of the frame, but if they try to stretch it larger than its original bounds, they can only expand it to what appears to be its original size + ExpandByPixels, after which the user cannot continue to fluidly drag it to a larger size.
If they stop, and then click and drag the size grip again, they can then drag it out to a larger size, but again this is constrained in the same way (current size + ExpandByPixels = the outer bound). They can repeat this cycle endlessly, expanding the frame to any size, but not fluidly in one mouse movement, which is what I want.
I have tested this same problem against TForm descendents as well, and get the same symptoms.
What am I missing here?
Thanks in advance for any and all help. :-)