PDA

View Full Version : User Interface timeout


dwenco
07-29-2008, 02:36 PM
I would like to timeout a screen/User Interface if the user does not respond in say 3 seconds, and carry on with the update/installation. I have tried the following and it just doesn't remove the screen. Is there anyway to get around it?

Thank you.

Screen.Show("Update Required");
Application.Sleep(3000);
Screen.End();

Ulrich
07-29-2008, 10:25 PM
Yes, there is. But note that the Application.Sleep(3000) you are using actually freezes the application for three seconds, and even if the user does something during this time, your updater will still ignore him. This is not what you are trying to do.

The better way would be this: Double-click the screen you wish to apply a timeout to. Open the "On Preload" tab and add the following:
-- These actions are performed before the screen is shown.
Screen.StartTimer(5000);

With this single line, you start a timer for the current screen. But just this doesn't do anything, you'll have to react to the timeout as well. So now open the "On Ctrl Message" and add the following for testing:

-- These actions are triggered by the controls on the screen.
if (e_MsgID == MSGID_ONTIMER) then
-- show a message before jumping to the next screen automatically
Dialog.Message("Notice", "Time's up!", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
-- now jump
Screen.Next();
end

Now, if you don't do anything for 5 seconds, you see a pop-up window, and once you close it, you will be redirected to the next screen.
I would recommend that you place the following at least in the "On Next" and "On Help" tabs as well, to avoid the firing of the timer event in the moment when the user is already responding or reading the help for the screen:

Screen.StopTimer();

Ulrich

Mark
07-30-2008, 08:47 AM
Hey upeters,

That's a really great solution to dwenco's problem. Great work!

dwenco
07-30-2008, 12:37 PM
Thanks a lot uPeter! That solved my problem :) All right.