Subject Re: Form closing when idle
From Mustansir Ghor <mustan31@hotmail.com>
Date Sat, 26 Jun 2021 02:00:13 -0400
Newsgroups dbase.getting-started

Dear Mervyn Sir

Thank you. All went well

I added close_on_idle::form_onclose() in the form.close() method of mustan.wfm to disable timer. Hope that is OK

Weekend Njema

Best Regards
Mustansir


Mervyn Bick Wrote

> On 2021/06/23 18:22, Mustansir Ghor wrote:
> > Dear Mervyn Sir
> >
> > Thank you.
> >
> > This will be similar to web app , where concept of timeout has its importance and one needs to login in again to resume the page.
> >
> > I had reached Chapter 10 on Ken Sir Web tutorial before something came up. I hope to resume it soon.
> >
> > I understood the amendments. but will put here just to be seen by you, if that this how it should be done.
> >
> > 1. the class definition of forms that are to be opened  from the MainForm will change to
> >
> >   class mustanForm of CLOSE_ON_IDLE from "close_on_idle.cfm"     from
> > class mustanForm of FORM (the form being mustan.wfm).  Only one statement. Rest of form content will remain same
> >
>
> I normally use pixels as the metric for my own forms and this is the
> metric originally used for close_on_idle.cfm.
>
> Before you change the class definition line in mustan.wfm you must make
> sure that the metric for mustan.wfm is the same as for
> close_on_idle.cfm.   If you mix the metrics you will wind up with a
> mess. :-(
>
> You have two options.  The first is open mustan.wfm in the designer and
> change it's metric to pixels.  This will recalculate all the settings.
> Save the file then you can change the class definition line to
>
> class mustanForm of CLOSE_ON_IDLE from "close_on_idle.cfm"
>
> The second option is to open close_on_idle.cfm in the designer and
> change the metric to match that of mustan.wfm.
>
> Opening close_on_idle.cfm in the designer and then saving it deletes the
> two lines immediately after the class definition.  You will need to open
> close_on_idle.cfm in the sourcecode editor and put these two lines back.
>
>
> class close_on_idle of FORM custom
>     #include winuser.h    // See note in the comments above
>     #define wm_mousewheel 0x020A  //not in winuser.h
>     with (this)
>
> After you have done this you can edit the class definition line in
> mustan.wfm.
>
> If you have a form_onOpen event handler in mustan.wfm you will need to
> add the following line as the first line in the event handler
>
>     function form_onOpen()
>        close_on_idle::form_onOpen()
>        //your code here which can include setting the allow_idle_time
> property
>        return
>
> > 2. Mustan.wfm form will need its metric to be in pixel.
>
> See above.
>
> >
> > 3. 3 routines will need to be put in all forms that needs to affected in form_onOpen method
> >        form.close_on_idle = true //change to false to disable close_on_idle
> >        close_on_idle::form_onOpen()
> >        form.timer.allow_idle_time := 15  //in seconds
>
>
> The default idle_time in close_on_idle.cfm is 120 seconds. You can
> overwrite it with anything you like but 15 seconds seems very short. If
> you want 15 minutes (which feels overly long) you need to use 15*60
>
>
> >
> > 4. If the readmodal forms are to be opened using menu item, then the subform routine (that you had put in the your example in Pushbutton) to be put in its on_click event
> >
>
> The code in the example turns off the timer for the main form and blanks
> the countdown (if it was visible) before displaying the readmodal form.
>   When the readmodal form is closed, either by the user or the timer,
> the timer in the main form is set active.  If there is no activity on
> the main form it will close after the set time.
>
>
> Mervyn.