On Apr 25, 2007, at 18:21 UTC, Peter K. Stys wrote: > First a thread, and now a timer???? What next?
Nothing's next. There's no step three. In fact, you can eliminate step 2 (the timer) if you prefer. > All we want is: > > for j = 1 to 1000000 > myWindow.myStaticText.text = str(j) > next > > for myStaticText to actually display the progress of the loop as it's > running (distilled example of course). OK, then put this loop in a thread and that's what it'll do. > I accept that App.DoEvents is unhealthy, but I second my own vote for > myWindow.refresh to do what one would expect: to safely update the > values of all the window's controls so the user can see that > something is actually happening. I hope I'm not one of your users. I don't just expect to see controls update; I expect the app to remain responsive -- I should be able to drag windows around (perhaps to get it out of the way while it does its long work), avoid the spinning wait cursor of death, and so on. Window.Refresh can't do all that; servicing the main event loop (by not tying up the main thread) does all that and also what Window.Refresh could do. It seems clear to me that the proper solution is to not tie up the main thread, so I don't really see the point of making improper half-baked solutions work slightly better. > We all have frequent instances I'm sure where code is running > iteratively, in many places and under many windows, so to have a > thread for each (...then a timer...then...) is needlessly complicated > IMHO. I think you're imagining it to be more complicated than it is. And no, I don't frequently have instances of such code, but when I do, I throw a Thread on the window (or if no window is handy, make a Thread subclass), call the long-running code from there, and it's done. > All the suggested workarounds indicate that a simple functionality is > not implemented correctly. I disagree. Your suggested solution indicates to me that you haven't yet grasped how a GUI, event-driven app works. Best, - Joe -- Joe Strout -- [EMAIL PROTECTED] _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
