At the same time, most often i want to run a batch operation like John, and all i want is the progressBar or a staticText value to be updated. So I use App.DoEvents, with no obvious issues.
RS says don't!, use a thread instead. but I need my batch operation to run synchronously with the rest of my app (ie. user can't continue doing anything else until the batch finishes). So now what? Now, not only do I have to create a thread for the batch, I have to make an extra effort to manually lock the user out of the app until the thread completes (haven't figured out a good way to do this). And on it goes. I understand how App.doEvents could be hazardous to your health. Instead, wouldn't it be just plain nice and simple if my loop could call myWindow.refresh at each iteration and this would simply do what everyone expects it to do: update the state of all controls in said window? No can do ASFAIK. This seems so obvious to me, why can't it just work? P. On 3/25/07, Charles Yeomans <[EMAIL PROTECTED]> wrote: > > On Mar 25, 2007, at 12:31 PM, RBNUBE wrote: > > > I've always been curious about this. I have heard a lot of people > > say not > > to do this, but I don't recall ever hearing any explanations as to > > why you > > shouldn't do this. Could you elaborate? > > > Sure. What is it that App.DoEvents does? Most everyone that uses it > cannot answer this question. > > As I understand it, DoEvents runs one iteration of the event loop. > So, what happens during the event loop -- just about everything. A > lot happens under the hood over which we have no control. That makes > it very difficult to write code whose outcome you can predict. You > will see reentrancy, which means that you need to write reentrant- > safe code in every method. And if you use plugins, you'll need to > contact the authors to ask them to do the same. > > Charles Yeomans > _______________________________________________ > Unsubscribe or switch delivery mode: > <http://www.realsoftware.com/support/listmanager/> > > Search the archives: > <http://support.realsoftware.com/listarchives/lists.html> > -- ------------------------------------------------------------------------------- Peter K. Stys, MD Professor of Medicine(Neurology), Senior Scientist Ottawa Health Research Institute, Div. of Neuroscience Ottawa Hospital / University of Ottawa Ontario, CANADA tel: (613)761-5444 fax: (613)761-5330 http://www.ohri.ca/profiles/stys.asp ------------------------------------------------------------------------------- _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
