Auto LogOff In PowerBuilder

Auto LogOff In PowerBuilder

To autologoff after an hour of inactivity, place code in events as follows:

If you are familiar with the workings of the Idle event, then you could have it start a timer on your frame window in PB5,

and there is a timer NVO in PFC 6.0. Both of these will trigger a timer event after the specified time length has expired.

Method 1:

Quick & dirty: log out any open transactions, and call a HALT CLOSE. This will force the application to close

immediately without any further processing. If you want open windows to be able to perform specific processing

before the app closes, then try something like Method 2.

Method 2:

Since you are using PFC, you could use the sheetmanager application service to pull a list of open sheet windows.

Inherit all of them from an application sheet ancestor and add a custom user event that will be triggered on all open

windows. Something like ue_IdleTimeout(). It will need a return code so the calling script will know when all the

processing is complete.

Instead of using an ancestor application sheet, you could also code this in w_master if you are using a copy of the

PFE layer for your application. Using w_master would allow you to include any open response windows, etc.,

though you have to figure out how get a reference to the non-sheet windows. Some tweaking to the sheetmanager

service might work.

In the window you declare the event, add the following script:

This is a PFC instance variable that will disable all closequery and pfc_Save processing. Add any other globally

required logic. Then, in the rest of your windows down the inheritance chain, add any other specific logic that is

necessary. Once this event has been triggered on all open windows, close all transactions, and perform a HALT

CLOSE just to make sure something didn’t get missed

Good Luck!


About The Author

Leave A Comment?