win32: constraint spinedit minimal width by updown width

git-svn-id: trunk@25632 -
This commit is contained in:
paul 2010-05-25 03:28:50 +00:00
parent f7fb57dbef
commit 12964e2686

View File

@ -52,6 +52,8 @@ type
const AParams: TCreateParams): HWND; override;
class procedure DefaultWndHandler(const AWinControl: TWinControl;
var AMessage); override;
class function GetConstraints(const AControl: TControl;
const AConstraints: TObject): Boolean; override;
class procedure GetPreferredSize(const AWinControl: TWinControl;
var PreferredWidth, PreferredHeight: integer;
WithThemeSpace: Boolean); override;
@ -255,6 +257,21 @@ begin
inherited DefaultWndHandler(AWinControl, AMessage);
end;
class function TWin32WSCustomFloatSpinEdit.GetConstraints(
const AControl: TControl; const AConstraints: TObject): Boolean;
var
SizeConstraints: TSizeConstraints absolute AConstraints;
SizeRect: TRect;
begin
Result := True;
if (AConstraints is TSizeConstraints) and TWinControl(AControl).HandleAllocated then
begin
Windows.GetWindowRect(GetWin32WindowInfo(TWinControl(AControl).Handle)^.UpDown, @SizeRect);
SizeConstraints.SetInterfaceConstraints(SizeRect.Right - SizeRect.Left, 0, 0, 0);
end;
end;
class procedure TWin32WSCustomFloatSpinEdit.GetPreferredSize(
const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer;
WithThemeSpace: Boolean);