I notice that the main window of my app does not refresh when the debugger is running. For instance, I’ve got this code to clear a ListBox. As I step through this code with the debugger, I’d expect to see the bottom most line in my ListBox deleted. But nothing happens. Then after the routine is finished, and control is returned to the main Window, the ListBox is suddenly clear. (As it should be.) But… I’d like to see the process happening step by step.
I’ve tried: myList.Refresh, mylist.Invalidate, and even app.doEvents. How do I get my app to update as I step through the debugger line by line?
Dim ii As Integer
For ii = myList.ListCount -1 To 0 Step -1
myList.RemoveRow(ii)
myList.Refresh
Next
Sorry English is not my first language, I have no experience in programming and I don’t really know what you want, but if you want to see each row disappear you can create a Method and use CallLater
First, your guys are great! I appreciate you getting back to me so quickly. Thanks for chiming in Alberto. Petty cool little routine you got there. I may be wrong by it looks like your RefreshListbox is recursive. Refrencing itself in the last statement of of the RefreshListbox method. (I didn’t even know that was possible.)
But seriously. I’m just using the incremental row deletion as an example. This is just a general debugging question. From my research and now these answers here, I’m inclined to conclude that Xojo just does update the app until after the end sub instruction.
Okay! The solution is simple! While the app itself is not updated line by line, the Variables in the window below the code is! And as need be, the Variables window can be expanded in a secondary window to be plenty large enough to show any incremental changes.
Turns out App.doEvents does what you’d expect it to do. Now, nicely updating the screen throughout incremental debugging.
(Not sure what I did wrong the first time I tried this. Apologies for the confusion.)
PS: Neither the local or online documentation mention App.doEvents. But rather, speak only of the Application.DoEvents method, which is VERY different from the App.doEvents method.