Vb to XOJO

On VB (DoEvents)

How i do this on XOJO WEB and Desktop app

It is not reccomended to use this (see other topics for more details)… but for Desktop apps at least there is

app.doevents

Not recommended is an understatement. Unexpected behavior can happen with app.doevents in Desktop and Web Apps. What are you trying to do with DoEvents in your code?

You know I still have never seen a reasonable explanation as to “WHY” this is an issue. I can see it being misused/overused… but I have found places where it is necessary.

Unless APP.DOEVENTS does things drastically differently than VB does… My understanding is that this simply forces the MESSAGE MANAGER to “catch up”… as in to take all pending events and execute them now before accepting new ones. This will make sure INVALIDATES catch up (or REFRESH if you are stilll there) etc.

If memory serves it was added specifically for console applications so that events would fire like you’d expect. Doing it in a desktop/web app where the events are already queued up…well…who knows how that affects the events and I think that’s the problem.

In my old VB6 days we used it a lot in tight loops to refresh the UI. In Xojo I’d just throw that code into a thread so the UI doesn’t freeze.

Anyway, in 12 years of doing Real Studio/Xojo work I have only used DoEvents in console applications. In all other cases a thread, invalidate or refresh has been good enough.

From the LR topic for DoEvents:

[quote]In GUI applications

Using DoEvents in a GUI application will likely cause instability. In effect, you would be placing a main event loop inside the “real” main event loop. You should consider using threads to handle lengthy operations rather than placing them in the main thread and calling DoEvents to maintain the interface.[/quote]

[quote=40983:@Dave S]
Unless APP.DOEVENTS does things drastically differently than VB does…[/quote]
Since Xojo is not VB it’s entirely likely it does it completely differently

The reason do events is a problem is that it can causes new events to arise while you’re still processing events
Literally it causes the main event loop to run again when you’re already in it so you can have re-entrancy problems

i fix my problem using a timer i need some REFRESH