mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-06 11:18:10 +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)
|
||||
private
|
||||
FDelayedShowing: Boolean;
|
||||
FAnimate: Boolean;
|
||||
FAnimateTimer: TTimer;
|
||||
FCurAnimationStep: Integer;
|
||||
@ -1047,6 +1048,7 @@ type
|
||||
FOnMouseMove: TMouseMoveEvent;
|
||||
function GetAnimateInterval: Cardinal;
|
||||
function GetCanvas: TCanvas;
|
||||
function InternalShow: Boolean;
|
||||
procedure SetAnimate(const AValue: Boolean);
|
||||
procedure SetAnimateInterval(const AValue: Cardinal);
|
||||
procedure SetHint(const AValue: string);
|
||||
@ -1061,6 +1063,7 @@ type
|
||||
protected
|
||||
class procedure WSRegisterClass; override;
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||
procedure Loaded; override;
|
||||
public
|
||||
Handle: HWND;
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
|
@ -37,6 +37,7 @@
|
||||
constructor TCustomTrayIcon.Create(TheOwner : TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
FDelayedShowing := False;
|
||||
|
||||
{ Default property values }
|
||||
FBalloonTimeout := 3000;
|
||||
@ -101,7 +102,9 @@ begin
|
||||
|
||||
if not(csDesigning in ComponentState) then
|
||||
begin
|
||||
Result := TWSCustomTrayIconClass(WidgetSetClass).Hide(Self);
|
||||
Result := not (csLoading in ComponentState);
|
||||
if Result then
|
||||
Result := TWSCustomTrayIconClass(WidgetSetClass).Hide(Self);
|
||||
FVisible := not Result;
|
||||
FAnimateTimer.Enabled := False;
|
||||
end
|
||||
@ -109,6 +112,27 @@ begin
|
||||
Result := false;
|
||||
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 ()
|
||||
*
|
||||
@ -126,13 +150,9 @@ begin
|
||||
FVisible := True;
|
||||
|
||||
if not(csDesigning in ComponentState) then
|
||||
begin
|
||||
Result := TWSCustomTrayIconClass(WidgetSetClass).Show(Self);
|
||||
FVisible := Result;
|
||||
FAnimateTimer.Enabled := FAnimate;
|
||||
end
|
||||
Result := InternalShow
|
||||
else
|
||||
Result := false;
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
@ -212,6 +232,13 @@ begin
|
||||
PopupMenu := nil;
|
||||
end;
|
||||
|
||||
procedure TCustomTrayIcon.Loaded;
|
||||
begin
|
||||
inherited Loaded;
|
||||
if FDelayedShowing then
|
||||
InternalShow;
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
* TCustomTrayIcon.InternalUpdate ()
|
||||
*
|
||||
@ -232,7 +259,8 @@ end;
|
||||
*******************************************************************}
|
||||
procedure TCustomTrayIcon.InternalUpdate;
|
||||
begin
|
||||
TWSCustomTrayIconClass(WidgetSetClass).InternalUpdate(Self);
|
||||
if not (csLoading in ComponentState) then
|
||||
TWSCustomTrayIconClass(WidgetSetClass).InternalUpdate(Self);
|
||||
end;
|
||||
|
||||
{*******************************************************************
|
||||
@ -352,3 +380,4 @@ begin
|
||||
end;
|
||||
|
||||
// included by extctrls.pp
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user