Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 19:23 17 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2 - Progress Bar

Author Message
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 425
Posted: 02:22pm 25 Feb 2021
Copy link to clipboard 
Print this post

As a spin off from https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=13527

Using SETTICK to make a progress bar works remarkably well:

CLS
MODE 1
PAGE WRITE 1

DIM RANGE AS INTEGER
RANGE = 1000000 'DURATION OF LOOP
SETTICK 1000,PBAR(RANGE)

SUB PBAR(RANGE)
  BOX 53,33,(MM-HRES-103)*(X%/RANGE),MM.VRES-556,3,RGB(GREEN),RGB(GREEN)
  BOX 50,30, MM.HRES-100,MM.VRES-550,3
  PAGE COPY 1 TO 2, B
END SUB

'DO SOME RANDOM STUFF

FOR X% = 1 TO RANGE
  A%=X%
NEXT

SETTICK 0,0,1 'STOP TICKER

PBAR(X%) ' FINISH OFF BAR TO 100%


Entropy is not what it used to be
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 04:39pm 25 Feb 2021
Copy link to clipboard 
Print this post

You can also use one from my TUI.INC library.

So your code will be:

MODE 1
PAGE WRITE 1
#INCLUDE "TUI.INC"

DIM RANGE AS INTEGER
RANGE = 1000000 'DURATION OF LOOP

DIM STRING dialog = TUIwaitingON("Progress bar test") 'open dialog
TUIwaitingProgress(dialog, 0) 'draw progress bar 0%
'DO SOME RANDOM STUFF

FOR X% = 1 TO RANGE
 A%=X%
 TUIwaitingProgress(dialog, 100*X%/RANGE) 'update progress bar in %
NEXT

TUIwaitingOFF(dialog) 'close dialog

Edited 2021-02-26 02:39 by jirsoft
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025