General downloads

NAV Progressbar

Author
René Thöne  
Category
General downloads
Date
05/01/2010
Size
6,62 KB
Downloads
2112
MD5 digest
74A71B5A9CA89F8915B5AF71CA1971B4
Rating
32121
Popularity
Not yet downloaded in the last two weeks
Function will easily display a Progressbar with Remaining Time, IntroText & InfoText and this features:
*Supress allways if not guiallowed (NAS-Modus)
*Open a Window with Headline, Progressbar and estimated remaining time.
*Positionfield (Infofield), if activated
*Update the Window at every n step (incl. calculating est. remaining time)
*Every Screenrefresh needs a lot of time! So better use high steps or autostep.
-Steps > 0: Every n. Update will be shown on Screen
-Steps = 0: Update after every 4% (= 25 Updates from 0% to 100%)
-Steps < 0: Autostep e.g. -5: 5 Updates will be done (at 20,40,60,80,100%)
Works in all Navisions from 1 till current (1.x & 2.x: just remove the lines with guiallowed and reduce the Stringlenght to 250 and remove the Cu-ID's).

Example how you did a ProgressBar before:

if guiallowed then
  window.open('I do something\\@1@@@@ #2###########');
Counter1 := 0
Counter2 := Rec.count
repeat
  Counter1 += 1;
  if guiallowed and Counter1 mod 100 = 0 then begin
    window.update(1,round(Counter1/Counter2*10000),1,'>');
    window.update(2,rec.code);
  end;
  do something
until next = 0;
if guiallowed then
  window.close;
You need 3 vars (Counter + Dialog), have to remember allways the Guiallowed (except you are using Navi from 3.x and using the NAS), don't do a division by zero in the progressbar, use the mod (the Window.update needs VERY MUCH TIME!! Don't update it every 1/10 Sec!! The ScreenRefresh needs more Time than your code!)

Now you only need one Var in your code: The CU Progressbar.
the Same Code as above would look like this:
Progressbar.init(Rec.count,100,true,'DoSomething');
repeat
  ProgressBar.update(Rec.Code);
  do something
until next = 0;
reduce the Statewindow to 1 Var (CU ProgressBar) and 2 lines of code! And not slower than before!
Download this file

Screenshots