Blitz3D+ Command Reference

UpdateProgBar progbar,progress#

Parameters

progbar - progress bar gadget to update

progress# - how full the bar is, as a fraction from 0.0 (empty) to 1.0 (full); values outside that range are clamped

Description

Sets how full a progress bar is.

The fraction is the whole interface: work out done divided by total and hand it over, so a level exporter on file 30 of 200 calls UpdateProgBar bar,30.0/200.0. Remember to make the division floating point - integer maths would give you 0 and a bar that only ever jumps at the end.

The bar is a smooth one with 10000 internal steps, so tiny increments really do move it rather than snapping between blocks. It is display-only: it posts no events and the user cannot drag it. Pair it with SetStatusText or a label if you also want to say what is being loaded.

The catch with any long job is that your window stops repainting while your code is busy, so the bar appears frozen no matter how often you update it. Drain the queue with PeekEvent inside the work loop - that lets pending native messages through, keeps the window responsive and gives you a chance to spot a click on a Cancel button.

See it working in the layout and controls sample, where a slider drives the bar live.

Requires Extended mode.

See also: CreateProgBar, SetStatusText, PeekEvent, CreateSlider, CreateLabel.

Index