Close a form after a while

Hi I’ve the following problem: I have an informative form launched by the OnTimer trigger in the main menu. The users are supposed to look at the showed data, take note of them, check a boolean field which means “Ok, I’ve seen it” and close the form. The form will pop up again after the appointed time, should the event that triggers it recurr. That works fine. Now, some users don’t work at their workstations all the time, they might have to leave now and then after some errands. If they stay away longer than the time interval, when they come back may find a number of copies of the abovesaid form waiting for them, which is quite annoying. So I put a value in the TimeInterval property of the pop-up form (a few minutes shorter than the value assigned to the main menu) and, in the OnTimer trigger I wrote the code: CurrForm.CLOSE I thought I had been so smart, but it doesn’t seem to work! The forms just stay open until someone comes and closes them. [:(!] What’s wrong with my solution? [8)] Thank you Anna

Hi Anna, What version are you using? I tried it on my 2.60 and it works like a charm… Is there anything else in the forms that might influence the flow of execution?

quote:


Originally posted by xorph
Hi Anna, What version are you using? I tried it on my 2.60 and it works like a charm… Is there anything else in the forms that might influence the flow of execution?


I’m using 3.60. I can’t think of nothing which might affect the process … maybe Friday night? [}:)] I’ll try again Monday! [:p] Thanks, by now. I’ll let you know! Anna

Hm, works in my 3.60 just as well… Maybe you really should wait for Monday, and if it still refuses to work by then, post some code etc. [;)] I created two empty forms, one has a timeout of 2000 and calls CurrForm.CLOSE in OnTimer. The other one has a timeout of 5000 and calls Form.RUN() in OnTimer. Works as planned. So I guess some other code or properties in your forms are causing the problems.

quote:


Originally posted by xorph
Hm, works in my 3.60 just as well… Maybe you really should wait for Monday, and if it still refuses to work by then, post some code etc. [;)] I created two empty forms, one has a timeout of 2000 and calls CurrForm.CLOSE in OnTimer. The other one has a timeout of 5000 and calls Form.RUN() in OnTimer. Works as planned. So I guess some other code or properties in your forms are causing the problems.


The main menu has a TimeInterval of 1800000 (30 minutes) and in the OnTimer trigger it calls a function which makes some checks to determine whether the second form must be launched, then launch it with the RUNMODAL function (might it be that?). The second form has a TimeInterval of 1500000 (25 nimutes) and only CurrForm.CLOSE in the OnTimer trigger. I started my main menu at 9:30 I worked on an other database until 12:30 and looked back. I had to close three forms. So, it seems that sometimes the trick worked and sometimes it didn’t, which even more confusing. [B)] Anna

quote:


Originally posted by Anna Perotti The main menu has a TimeInterval of 1800000 (30 minutes) and in the OnTimer trigger it calls a function which makes some checks to determine whether the second form must be launched, then launch it with the RUNMODAL function (might it be that?). The second form has a TimeInterval of 1500000 (25 nimutes) and only CurrForm.CLOSE in the OnTimer trigger. I started my main menu at 9:30 I worked on an other database until 12:30 and looked back. I had to close three forms. So, it seems that sometimes the trick worked and sometimes it didn’t, which even more confusing. [B)] Anna


Sorry for jumping in [:)]. IMHO the trick doesn’t work in your case. If you calculate (starting from 9:30): 30-25-30-25-30-25 then you are landing at 12:15 (with three open forms). I guess the fourth form would be open at 12:45. Perhaps (not sure) Form.Run would be better way to do this. bye André

Anna, I tried it and the problem is definitely caused by RUNMODAL. If I use RUNMODAL, the launched form never closes. The first form, however, continues popping up forms “in the background” which remain invisible. Once the launched form is closed, the next one in the queue pops up immediately. Try it with RUN and let me know if it worked.

quote:


Originally posted by xorph
Anna, I tried it and the problem is definitely caused by RUNMODAL. If I use RUNMODAL, the launched form never closes. The first form, however, continues popping up forms “in the background” which remain invisible. Once the launched form is closed, the next one in the queue pops up immediately. Try it with RUN and let me know if it worked.


Yeah! That’s it! [}:)] I wonder if I had a valuable reason to use RUNMODAL instead of RUN … Let’s see what happens forth. [:D] Thank you, Heinz; thank you, André! Anna

Glad to hear it works now [8D] Actually, program logic seems to require a RUN instead of a RUNMODAL here… You must have had some very good reasons to use RUNMODAL, otherwise it was a classic bug [:D][:D][:D]

quote:


Originally posted by xorph
Glad to hear it works now [8D] Actually, program logic seems to require a RUN instead of a RUNMODAL here… You must have had some very good reasons to use RUNMODAL, otherwise it was a classic bug [:D][:D][:D]


Mhmm … maybe I’ve found that reason! At first the pop-up form was supposed to appear only at the user log in, then it might be manually launched, but it didn’t pop up by itself any more. A function performing the necessary checks and executing form.runmodal was called in the OnOpen trigger. After a while the customer asked that it would appear every some minutes, since he didn’t trust his user to check it now and then. The same function is now called by the OnTimer trigger; you know the story. [;)] Now that I’ve changed RUNMODAL with RUN the form is behaving correctly when launched from OnTimer, but when launched from OnOpen it remains in the background. Don’t know why, but so it does. I guess I’ll have to make two distinct functions! [xx(] Anna

quote:


Originally posted by Anna Perotti
I guess I’ll have to make two distinct functions! [xx(]


Having a RUN in OnTimer and a RUNMODAL in OnOpen doesn’t do the trick? Ooops… forgot you mentioned a check function. What about passing a parameter to this function to switch between RUN and RUNMODAL?

quote:


Originally posted by xorph

quote:


Originally posted by Anna Perotti
I guess I’ll have to make two distinct functions! [xx(]


Having a RUN in OnTimer and a RUNMODAL in OnOpen doesn’t do the trick? Ooops… forgot you mentioned a check function. What about passing a parameter to this function to switch between RUN and RUNMODAL?


Yes, that’s just what I’m doing, right now! [:D] Thank you Anna