lcl: don't set hint window region if window handle is not allocated

git-svn-id: trunk@29645 -
This commit is contained in:
paul 2011-02-22 07:21:00 +00:00
parent 94fa55e000
commit ffe4871a0b
2 changed files with 25 additions and 12 deletions

View File

@ -824,6 +824,7 @@ type
protected
class procedure WSRegisterClass; override;
procedure DoShowWindow; override;
procedure UpdateRegion;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@ -832,6 +833,7 @@ type
AData: pointer); virtual;
function CalcHintRect(MaxWidth: Integer; const AHint: String;
AData: Pointer): TRect; virtual;
procedure InitializeWnd; override;
procedure ReleaseHandle;
procedure Paint; override;
procedure SetBounds(ALeft, ATop, AWidth, AHeight: integer); override;

View File

@ -78,6 +78,21 @@ begin
end;
end;
procedure THintWindow.UpdateRegion;
var
ARect: TRect;
Details: TThemedElementDetails;
Rgn: HRGN;
begin
if (Color = clInfoBk) or (Color = clDefault) then
begin
Details := ThemeServices.GetElementDetails(tttStandardNormal);
ARect := ClientRect;
Rgn := ThemeServices.GetDetailRegion(Canvas.Handle, Details, ARect);
SetWindowRgn(Handle, Rgn, False);
end;
end;
function THintWindow.GetDrawTextFlags: Cardinal;
var
EffectiveAlignment: TAlignment;
@ -110,7 +125,6 @@ Begin
FAutoHideTimer.Enabled := False;
end;
procedure THintWindow.AutoHideHint(Sender : TObject);
begin
if FAutoHideTimer <> nil then
@ -147,19 +161,10 @@ begin
end;
procedure THintWindow.SetBounds(ALeft, ATop, AWidth, AHeight: integer);
var
ARect: TRect;
Details: TThemedElementDetails;
Rgn: HRGN;
begin
inherited SetBounds(ALeft, ATop, AWidth, AHeight);
if (Color = clInfoBk) or (Color = clDefault) then
begin
Details := ThemeServices.GetElementDetails(tttStandardNormal);
ARect := ClientRect;
Rgn := ThemeServices.GetDetailRegion(Canvas.Handle, Details, ARect);
SetWindowRgn(Handle, Rgn, False);
end
if HandleAllocated then
UpdateRegion;
end;
class function THintWindow.GetControlClassDefaultSize: TSize;
@ -236,6 +241,12 @@ begin
//debugln('THintWindow.CalcHintRect Result=',dbgs(Result));
end;
procedure THintWindow.InitializeWnd;
begin
inherited InitializeWnd;
UpdateRegion;
end;
procedure THintWindow.ReleaseHandle;
begin
if HandleAllocated then