using STOP-AFTER

Posted by hermes on 04-Apr-2017 13:59

Hello,

I am not sure where I am going wrong wrong but using STOP-AFTER I am expecting a set time period to run then inside a dialog window  the ok button is "clicked" so the window terminates after a certain period of time. I was trying the below but the results are not what I am expecting

 DO STOP-AFTER 10 ON STOP UNDO, RETRY:
   RUN terminmess.
 END.
 APPLY "ENTRY":U TO btnOk IN FRAME gDialog.



then in proceedure terminmess

vLimit = 10.


DO WHILE vcounts > 0 STOP-AFTER vLimit:
vcounts = vcounts + 1.
END.

All Replies

Posted by Laura Stern on 04-Apr-2017 14:55

Sorry, but if you're sitting in a dialog box, waiting for and processing user input, you cannot also be executing this code you are showing.  Conversely, I could say, this code is basically in a busy loop, incrementing your vcounts variable over and over for 10 seconds.  The UNDO, RETRY makes it appear as if you want this to happen forever!!  (But luckily we will change that to UNDO, LEAVE as part of our infinite loop protection.)  If it is doing that, nothing else will be going on during that 10 seconds.  And therefore, your dialog box seems fairly useless.   Where is this code relative to the WAIT-FOR and any trigger code you have for the dialog-box?  Do you know that it is even running?

Maybe you intended to have the STOP-AFTER around your WAIT-FOR statement?  If so, you don't need your little busy loop in routine terminmess. But I don't think that will work anyway since I don't believe we abide by STOP-AFTER in input-blocking statements.  Maybe you really want to use WAIT-FOR... PAUSE 10?

Posted by hermes on 05-Apr-2017 07:53

I had actually switched it back to leave but I saw the code showed retry (I was seeing if I could get a different result) sorry bout that. But does anyone know if this is indeed possible, I don't have much experience with using STOP-AFTER, the dialog window does fire but it does not pass in the text and  closes after the time period but then spawns another window which does not close.

Posted by Laura Stern on 05-Apr-2017 08:22

You are throwing out tidbits of information that are out of context and therefore make no sense.  "does not pass in the text"?  What text?  "Spawns another window"?  What spawns another window and how?  

You really need to back up and start from the beginning.  Instead of explaining your solution, you need to first explain what you are trying to do.   Is this a real dialog box that the user interacts with, or is it a status window?  What is this text or this other window you are talking about?  Are those actually relevant to the problem or are those different problems?  Explain what you want to have happen from the user's point of view.

Posted by hermes on 10-Apr-2017 08:03

I guess i am looking for more of a proof of concept, I am seeing unusual things when I call the dialog box after defining some test text to go into the dialog box. I guess I am just asking if it is possible to have an event trigger after a certain period of time passes which would click a button. The user could also click the button if they want to but after a certain period of time it will be clicked. Is there anyone who is sure this can happen?

Posted by Laura Stern on 10-Apr-2017 08:25

You can't use STOP-AFTER for that.  You could use an ActiveX or, preferably, a .NET Timer (System.Windows.Forms.Timer).  Set the interval and Subcribe to the Tick event.  When it fires, then APPLY "CHOOSE" to the button.  And make sure you turn the time off!

Posted by Brian K. Maher on 11-Apr-2017 21:29

hermes,
 
Please open a case with support.  We need to see the code to help you resolve this.
 
Brian

Posted by Brian K. Maher on 11-Apr-2017 21:30

You should be looking into the timer control.

This thread is closed