From: <ob...@us...> - 2008-03-14 10:50:27
|
Revision: 11765 http://jvcl.svn.sourceforge.net/jvcl/?rev=11765&view=rev Author: obones Date: 2008-03-14 03:50:25 -0700 (Fri, 14 Mar 2008) Log Message: ----------- Mantis 4357: Autosize lead to a stack overflow. It has been changed so that it will only resize if the control has children, else Autosize has no effects. Modified Paths: -------------- trunk/jvcl/run/JvComCtrls.pas Modified: trunk/jvcl/run/JvComCtrls.pas =================================================================== --- trunk/jvcl/run/JvComCtrls.pas 2008-03-12 16:04:30 UTC (rev 11764) +++ trunk/jvcl/run/JvComCtrls.pas 2008-03-14 10:50:25 UTC (rev 11765) @@ -1,4 +1,4 @@ -{----------------------------------------------------------------------------- +{----------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -166,6 +166,7 @@ FOnChange: TNotifyEvent; FFocusFromField: Boolean; FDataConnector: TJvIPAddressDataConnector; + procedure SetDataConnector(const Value: TJvIPAddressDataConnector); procedure ClearEditControls; procedure DestroyLocalFont; @@ -190,7 +191,7 @@ procedure FontChanged; override; function DoEraseBackground(Canvas: TCanvas; Param: Integer): Boolean; override; procedure AdjustHeight; - procedure AdjustSize; override; + function GetControlExtents: TRect; override; procedure CreateParams(var Params: TCreateParams); override; procedure CreateWnd; override; procedure DestroyWnd; override; @@ -1097,12 +1098,6 @@ end;} end; -procedure TJvIPAddress.AdjustSize; -begin - inherited AdjustSize; - RecreateWnd; -end; - procedure TJvIPAddress.ClearAddress; begin if HandleAllocated then @@ -1341,6 +1336,25 @@ inherited; end; +function TJvIPAddress.GetControlExtents: TRect; +var + ClientRect: TRect; + Extents: TRect; +begin + if ControlCount = 0 then + begin + // to avoid resizing to zero size when setting AutoSize to True + Result := GetClientRect; + end + else + begin + // If the control has children, then resize to the union of both possible rectangles + Extents := inherited GetControlExtents; + ClientRect := GetClientRect; + UnionRect(Result, Extents, ClientRect); + end; +end; + procedure TJvIPAddress.GetDlgCode(var Code: TDlgCodes); begin Include(Code, dcWantArrows); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |