1. Ingmar Thomassen
  2. PowerBuilder
  3. Monday, 17 January 2022 07:47 AM UTC

Hi

 

I am looking for a piece of code or function so that my application will close after x minutens of no activity. 

Anyone know how to code this

Thanks in advanged

Cheers Ingmar

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 17 January 2022 07:50 AM UTC
  2. PowerBuilder
  3. # 1

Hi Ingmar

You can code the idle() event of the application object. Just do a HALT CLOSE in that event. The "CLOSE" will guarantee that any code in the application's close() event will be executed first.

See on how to setup the Idle() event: https://docs.appeon.com/pb2019/powerscript_reference/ch10s307.html

regards

Comment
  1. Miguel Leeuwe
  2. Monday, 17 January 2022 17:13 PM UTC
For good practice: do an "Idle(0)" before doing the HALT CLOSE to off the timer on the idle event.
  1. Helpful
  1. Olan Knight
  2. Monday, 17 January 2022 21:10 PM UTC
Thanks for this.

I actually need the opposite feature, a "stay alive" option. After X minutes I will sent a query t o the database to keep my connection open!

  1. Helpful
  1. Miguel Leeuwe
  2. Tuesday, 18 January 2022 00:46 AM UTC
Hi Olan,

We do the "exact" same thing for our Oracle database connection, but ... we do it with a timer() on a timer event of our mdi frame window. Theoretically, if a user just opens some window, and does nothing else (database related), like for example: "moving the mouse around for some minutes", then your idle() event isn't fired (since the app isn't 'idle'). You could still be disconnected from the database, since the idle event of the app object won't run and your "heart beat select" won't execute.

regards

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.