Platforms to show: All Mac Windows Linux Cross-Platform

DelayMBS(time as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method System MBS Util Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Stopps the application for the given time.
Example
DelayMBS 1.5 // wait one and a half seconds

The application should take nearly 0% CPU Power till time has gone.
If you need more options like blocking other RB threads, check the DelayMBS method with mode parameter.

Another example from Kirk Clendinning:

Property: lastupdate as Integer

Sub YieldProcessorTime(periodticks as Integer, widthmilliseconds as Integer)
// use the Monkeybread Software delay to yeild time for a screen update
// every period*ticks for a pulse width of width milliseconds

if ticks>lastupdate+periodTicks then
delayMBS widthmilliseconds/1000
lastupdate=ticks
end if

exception err
ExceptionReport(err, "Utils:Methods:YieldProcessorTime")
end sub

YieldProcessorTime(15, 20) gives me a delay of 20ms every 250ms. But,
since the delayMBS yields time more efficiently than using a RB thread, this turns out to be a much more effective way to update progress bars etc.
I don't need the delay per se, but since RB still hasn't written a good yield function (that I know of) your delayMSB works instead.

Please use optional mode flags with DelayDontWaitNextEvent when using on thread.

Using DelayMBS on Web Applications can cause problems as the server is paused than for all clients, a really bad thing.

See also:

Some examples using this global method:

DelayMBS(time as Double, mode as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method System MBS Util Plugin 6.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Stopps the application for the given time.
Example
DelayMBS 1.5, 0 // wait one and a half seconds

Like DelayMBS with one parameter but additional mode parameter:

combine the following constants:

const DelayDontMPYield = 1// Don't give additional time for other OS threads
const DelayDontRBYield = 2// Don't give Xojo time for other Xojo threads
const DelayDontThreadYield = 4// Don't give addition time for other OS threads
const DelayDontQuickTimeYield = 8// Don't give time for QuickTime Movieplayer
const DelayDontWait = 16// Don't give CPU time for other OS threads
const DelayDontWaitNextEvent = 32// Don't give CPU time to handle events on Mac OS X to avoid beachball cursor
const DelayDontSleep = 64// Don't give CPU time for other OS threads (Windows)

Using DelayDontWaitNextEvent may show the beach ball cursor, but will have the OpenDocument event working as other AppleEvents. Please use DelayDontWaitNextEvent option for running on threads.

Using DelayMBS on Web Applications can cause problems as the server is paused than for all clients, a really bad thing.

See also:

Some examples using this global method:

Blog Entries

Xojo Developer Magazine

The items on this page are in the following plugins: MBS Util Plugin.


The biggest plugin in space...