Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Two things: HowTo progmatically close MessageDlg AND Application.IdleTimeout not resetting
Fri, Jul 8 2016 4:31 PMPermanent Link

Trinione

First is a question:
How to progmatically close MessageDlg ?
------------------------------------------------------------------------------------

Second is an observation / bug.

I provide a warning before logging out user. Whilst testing the functionality I just noticed that upon setting the timeout to the same value it was previously it does not work the second time.

procedure Tfrm1.AppOnIdleWarningEvent (Sender: TObject);
begin
ShowMessage('Ahhh!');
 Application.IdleTimeout := 6; //300;
 Application.OnIdle := AppOnIdleLogoutEvent;

 MessageDlg('You will be disconnected soon. Stay connected ?', 'Inactivity detected',
     mtConfirmation, [mbYes,mbNo], mbNo, TimeoutWarning, True);
end;

procedure Tfrm1.AppOnIdleLogoutEvent (Sender: TObject);
begin
ShowMessage('Hmmmmm!');
 LogoutNow;
end;

procedure Tfrm1.CheckTimeoutWarning(DlgResult: TModalResult);
begin
 if (DlgResult = mrNo) then
   LogoutNow
 else
   SetAppTimeout;
end;

procedure Tfrm1.SetAppTimeout;
begin
 Application.IdleTimeout := 5; //600;
 Application.OnIdle := AppOnIdleWarningEvent;
end;
Fri, Jul 8 2016 6:40 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com


<< How to progmatically close MessageDlg ? >>

You can't.  If you want that level of control, then you should create your own message dialog form (use TMessageDialog as the ancestor class instead of TForm).

<< I provide a warning before logging out user. Whilst testing the functionality I just noticed that upon setting the timeout to the same value it was previously it does not work the second time. >>

The OnIdle event is a one-shot deal. Once it fires, it won't fire again until any mouse/touch/keyboard events occur and it starts the countdown again.

Tim Young
Elevate Software
www.elevatesoft.com
Sat, Jul 9 2016 6:28 AMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> The OnIdle event is a one-shot deal. Once it fires, it won't fire
> again until any mouse/touch/keyboard events occur and it starts the
> countdown again.

That's a detail that might be worth putting in the manual as it could
be handy to know. It is sort of obvious, but also not.

--

Matthew Jones
Sat, Jul 9 2016 11:29 AMPermanent Link

Trinione

<< The OnIdle event is a one-shot deal. Once it fires, it won't fire again until any mouse/touch/keyboard events occur and it starts the countdown again. >>

Tim:
In the sample code I gave above, both should be at '5' for example. However, the code works with different times set. So, when I change the second one to say '10' seconds, it works. I can live with that. Just wanted to point it out in case others came across this issue and were searching on it.
Mon, Jul 11 2016 8:43 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< That's a detail that might be worth putting in the manual as it could be handy to know. It is sort of obvious, but also not. >>

I updated the docs to reflect this.

Tim Young
Elevate Software
www.elevatesoft.com
Image