fix autoszie if RxLoockup

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1196 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2010-04-08 17:26:33 +00:00
parent aaa4fc90da
commit 0653014d4e
2 changed files with 21 additions and 6 deletions

View File

@ -230,9 +230,10 @@ type
procedure UpdateData; procedure UpdateData;
procedure NeedUpdateData; procedure NeedUpdateData;
protected protected
procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
WithThemeSpace: Boolean); override;
procedure ShowList; virtual; procedure ShowList; virtual;
procedure OnClosePopup(AResult:boolean);virtual; procedure OnClosePopup(AResult:boolean);virtual;
procedure DoAutoSize; override;
procedure SetEnabled(Value: Boolean); override; procedure SetEnabled(Value: Boolean); override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure KeyPress(var Key: char); override; procedure KeyPress(var Key: char); override;
@ -1118,6 +1119,24 @@ begin
end; end;
end; end;
procedure TRxCustomDBLookupCombo.CalculatePreferredSize(var PreferredWidth,
PreferredHeight: integer; WithThemeSpace: Boolean);
var
tmpCanvas: TCanvas;
begin
inherited CalculatePreferredSize(PreferredWidth, PreferredHeight,
WithThemeSpace);
// ignore width
PreferredWidth:=0;
tmpCanvas := GetWorkingCanvas(Canvas);
try
PreferredHeight:=Canvas.TextHeight('Wg')+12;
finally
if TmpCanvas<>Canvas then
FreeWorkingCanvas(tmpCanvas);
end;
end;
procedure TRxCustomDBLookupCombo.OnClosePopup(AResult: boolean); procedure TRxCustomDBLookupCombo.OnClosePopup(AResult: boolean);
begin begin
if Assigned(FRxPopUpForm) and AResult and (pfgColumnResize in FPopUpFormOptions.Options) then if Assigned(FRxPopUpForm) and AResult and (pfgColumnResize in FPopUpFormOptions.Options) then
@ -1151,11 +1170,6 @@ begin
FOnSelect(Self); FOnSelect(Self);
end; end;
procedure TRxCustomDBLookupCombo.DoAutoSize;
begin
Height:=Canvas.TextHeight('Wg')+12;
end;
procedure TRxCustomDBLookupCombo.SetEnabled(Value: Boolean); procedure TRxCustomDBLookupCombo.SetEnabled(Value: Boolean);
begin begin
inherited SetEnabled(Value); inherited SetEnabled(Value);

View File

@ -787,6 +787,7 @@ begin
FPopup := CreatePopupCalendar(Self {$IFDEF USED_BiDi}, BiDiMode {$ENDIF}); FPopup := CreatePopupCalendar(Self {$IFDEF USED_BiDi}, BiDiMode {$ENDIF});
FPopup.OnCloseUp := @PopupCloseUp; FPopup.OnCloseUp := @PopupCloseUp;
FPopup.Color := FPopupColor; FPopup.Color := FPopupColor;
FPopup.Visible:=false;
{$ELSE} {$ELSE}
FPopup:=nil; FPopup:=nil;
{$ENDIF DEFAULT_POPUP_CALENDAR} {$ENDIF DEFAULT_POPUP_CALENDAR}