mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-20 20:45:58 +02:00
TCustomTrayIcon: added InternalShow() private proc, so it triggers TCustomTrayIcon.Show when component is loaded. Fixes problem when popupmenu isn't shown.See issue #19693
git-svn-id: trunk@31600 -
This commit is contained in:
parent
f6ca7c7d1b
commit
910a46ff7d
@ -1028,6 +1028,7 @@ type
|
|||||||
|
|
||||||
TCustomTrayIcon = class(TLCLComponent)
|
TCustomTrayIcon = class(TLCLComponent)
|
||||||
private
|
private
|
||||||
|
FDelayedShowing: Boolean;
|
||||||
FAnimate: Boolean;
|
FAnimate: Boolean;
|
||||||
FAnimateTimer: TTimer;
|
FAnimateTimer: TTimer;
|
||||||
FCurAnimationStep: Integer;
|
FCurAnimationStep: Integer;
|
||||||
@ -1047,6 +1048,7 @@ type
|
|||||||
FOnMouseMove: TMouseMoveEvent;
|
FOnMouseMove: TMouseMoveEvent;
|
||||||
function GetAnimateInterval: Cardinal;
|
function GetAnimateInterval: Cardinal;
|
||||||
function GetCanvas: TCanvas;
|
function GetCanvas: TCanvas;
|
||||||
|
function InternalShow: Boolean;
|
||||||
procedure SetAnimate(const AValue: Boolean);
|
procedure SetAnimate(const AValue: Boolean);
|
||||||
procedure SetAnimateInterval(const AValue: Cardinal);
|
procedure SetAnimateInterval(const AValue: Cardinal);
|
||||||
procedure SetHint(const AValue: string);
|
procedure SetHint(const AValue: string);
|
||||||
@ -1061,6 +1063,7 @@ type
|
|||||||
protected
|
protected
|
||||||
class procedure WSRegisterClass; override;
|
class procedure WSRegisterClass; override;
|
||||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||||
|
procedure Loaded; override;
|
||||||
public
|
public
|
||||||
Handle: HWND;
|
Handle: HWND;
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
constructor TCustomTrayIcon.Create(TheOwner : TComponent);
|
constructor TCustomTrayIcon.Create(TheOwner : TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
|
FDelayedShowing := False;
|
||||||
|
|
||||||
{ Default property values }
|
{ Default property values }
|
||||||
FBalloonTimeout := 3000;
|
FBalloonTimeout := 3000;
|
||||||
@ -101,6 +102,8 @@ begin
|
|||||||
|
|
||||||
if not(csDesigning in ComponentState) then
|
if not(csDesigning in ComponentState) then
|
||||||
begin
|
begin
|
||||||
|
Result := not (csLoading in ComponentState);
|
||||||
|
if Result then
|
||||||
Result := TWSCustomTrayIconClass(WidgetSetClass).Hide(Self);
|
Result := TWSCustomTrayIconClass(WidgetSetClass).Hide(Self);
|
||||||
FVisible := not Result;
|
FVisible := not Result;
|
||||||
FAnimateTimer.Enabled := False;
|
FAnimateTimer.Enabled := False;
|
||||||
@ -109,6 +112,27 @@ begin
|
|||||||
Result := false;
|
Result := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{*******************************************************************
|
||||||
|
* TCustomTrayIcon.InternalShow()
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Called when component is loaded, if Show() is called during
|
||||||
|
* loading.
|
||||||
|
*
|
||||||
|
* PARAMETERS: None
|
||||||
|
*
|
||||||
|
* RETURNS: If successfull
|
||||||
|
*
|
||||||
|
*******************************************************************}
|
||||||
|
function TCustomTrayIcon.InternalShow: Boolean;
|
||||||
|
begin
|
||||||
|
FDelayedShowing := csLoading in ComponentState;
|
||||||
|
if FDelayedShowing then
|
||||||
|
exit(False);
|
||||||
|
Result := TWSCustomTrayIconClass(WidgetSetClass).Show(Self);
|
||||||
|
FVisible := Result;
|
||||||
|
FAnimateTimer.Enabled := FAnimate;
|
||||||
|
end;
|
||||||
|
|
||||||
{*******************************************************************
|
{*******************************************************************
|
||||||
* TCustomTrayIcon.Show ()
|
* TCustomTrayIcon.Show ()
|
||||||
*
|
*
|
||||||
@ -126,13 +150,9 @@ begin
|
|||||||
FVisible := True;
|
FVisible := True;
|
||||||
|
|
||||||
if not(csDesigning in ComponentState) then
|
if not(csDesigning in ComponentState) then
|
||||||
begin
|
Result := InternalShow
|
||||||
Result := TWSCustomTrayIconClass(WidgetSetClass).Show(Self);
|
|
||||||
FVisible := Result;
|
|
||||||
FAnimateTimer.Enabled := FAnimate;
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
Result := false;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{*******************************************************************
|
{*******************************************************************
|
||||||
@ -212,6 +232,13 @@ begin
|
|||||||
PopupMenu := nil;
|
PopupMenu := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomTrayIcon.Loaded;
|
||||||
|
begin
|
||||||
|
inherited Loaded;
|
||||||
|
if FDelayedShowing then
|
||||||
|
InternalShow;
|
||||||
|
end;
|
||||||
|
|
||||||
{*******************************************************************
|
{*******************************************************************
|
||||||
* TCustomTrayIcon.InternalUpdate ()
|
* TCustomTrayIcon.InternalUpdate ()
|
||||||
*
|
*
|
||||||
@ -232,6 +259,7 @@ end;
|
|||||||
*******************************************************************}
|
*******************************************************************}
|
||||||
procedure TCustomTrayIcon.InternalUpdate;
|
procedure TCustomTrayIcon.InternalUpdate;
|
||||||
begin
|
begin
|
||||||
|
if not (csLoading in ComponentState) then
|
||||||
TWSCustomTrayIconClass(WidgetSetClass).InternalUpdate(Self);
|
TWSCustomTrayIconClass(WidgetSetClass).InternalUpdate(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -352,3 +380,4 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// included by extctrls.pp
|
// included by extctrls.pp
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user