Hello, I was wondering (never seen used anywhere) what the option in a button on a form called “Stop Processing” exactly do. How does this option manage a transaction for instance? Thank You John
The fact is that i’ve never tried it… but it sounds like the same functionality you’ve on the Cancel button when showing a dialog. If you’re having a process that’s going through a set of data and you’re having that button (let’s say that instead of displaying a dialog you’re displaying that form you’re updating on your processing loop…) it will probably break that processing cancelling the loop.
hi all, I am trying to use this stop feature, or any other way to provide the user with a cancel button that will stop processing. No matter what I try, I find the GUI is frozen till processing has completed. The form is simple - a Start button, a Stop button ,and an indicator (which won’t update - but that is another issue) Once started, the form iterates through a header table calling a Codeunit method which processes the data, writing data to another table. Back in the form, after each header record, I update the integer that is the source expression for the progress Indicator, and call YIELD. My loop continues till NEXT = 0 or my quit variable is = false - the latter being something that never happens as the gui doesn’t accept any input once the import process starts. I have searched the archives for a solution to this with no success - any input would be welcome! DD
Not sure if you know it or not, but the yield command is just releasing CPU cycles to other tasks, it is not yeilding control to another process in Navision. I am not sure here how you plan to actually set a “QUIT” variable to false? If you present an option to the user inbetween each iteration, then they will have to click yes many times to complete the task. Why exactly do you want the user to abort the process. On solution is to have (instead of a loop), the codeunit caled from the OnTimer of a form, and add a button on the form to set your variable, but this will slow things down a lot.
Use a report (processing only) or a codeunit with a dialog (window)in stead - that’s the Navision way of doing things (though I might be tempted to explore your approach).
Thanks for the responses! I was planning to set the global variable to false when the user clicks the Stop button - but the GUI doesn’t recognize any user action till the process is complete. So, is there a difference between a dialog being displayed from a codeunit and a form that calls a codeunit? Will a dialog be able to respond to a user’s mouse click?
Yep, try it out - you’ll see… [;)]
Hey thanks for the dialog suggestion, it is definitely more [responsive / functional] for user feedback! Any ideas on how to make the cancel button cancel?
If you use a WIN.UPDATE within your processing loop e.g. WIN.OPEN('Count #1####'); REPEAT I := I + 1; WIN.UPDATE(1, I); UNTIL FALSE;
it’ll work automatically.
Okay, thanks everyone, I found if I hammer on the eskape key long enough it eventually gets the message in the dialog. So we never did shed any light on the Stop feature of a form button