win32: prevent combobox height resizing since windows combobox has fixed height (by Mattias instructions)

git-svn-id: trunk@12638 -
This commit is contained in:
paul 2007-10-30 02:18:01 +00:00
parent c644f33dc3
commit a1e7edc076
2 changed files with 22 additions and 0 deletions

View File

@ -328,6 +328,11 @@ begin
begin
FixedHeight := true;
FixedWidth := true;
end
else
if SizeConstraints.Control is TCustomComboBox then
begin
FixedHeight := True; // win32 combo has fixed height
end;
if (FixedHeight or FixedWidth)

View File

@ -83,6 +83,8 @@ type
const AParams: TCreateParams): HWND; override;
class procedure AdaptBounds(const AWinControl: TWinControl;
var Left, Top, Width, Height: integer; var SuppressMove: boolean); override;
class procedure GetPreferredSize(const AWinControl: TWinControl;
var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); override;
class function GetSelStart(const ACustomComboBox: TCustomComboBox): integer; override;
class function GetSelLength(const ACustomComboBox: TCustomComboBox): integer; override;
class function GetItemIndex(const ACustomComboBox: TCustomComboBox): integer; override;
@ -768,6 +770,21 @@ begin
Height := StringList.ComboHeight;
end;
class procedure TWin32WSCustomComboBox.GetPreferredSize(
const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer;
WithThemeSpace: Boolean);
begin
if not AWinControl.HandleAllocated then
begin
// any idea about?
PreferredHeight := 0;
end
else
begin
PreferredHeight := AWinControl.Height;
end;
end;
class function TWin32WSCustomComboBox.GetSelStart(const ACustomComboBox: TCustomComboBox): integer;
begin
SendMessage(ACustomComboBox.Handle, CB_GETEDITSEL, Windows.WPARAM(@Result), Windows.LPARAM(nil));