`
Par2: Smooth Process window/progress thermometer 1998-07-19 -- Martin Hoddin Herewith a SMOOTH Process window/progress thermometer. The idea is NOT mine, thanks to tips from the group. Thank you all , you know who you are. Sorry, you template gurus, I do not know how to put it in a template. I have modified the generic window and embeds in the template registry, so this comes up on all my windows. It is just so easy to delete bits not needed. Coloring of the progress is simple. You choose your own. Size of the panel and string is up to you, and the progress calculation is not dependent on the size thereof. There is a "how many minutes to go calculation" included. Pause or cancel buttons are accessible each firing of the timer, and also the escape key alerted on the window. Hundreds of CPD2.1 reports have forced my hand, and now they are easy, and I do not get caught in the loop with no keycode escape. Sorry, Mr Wet Noodles, for a long message, but less than 100 lines. I do not know how to zip it up and attach it, no time to learn. ! GLOBAL DATA RecsToDo LONG RecsDone LONG ! LOCAL DATA WAIT BYTE CHECKER BYTE HOWLONG STRING(100) COUNTER LONG STARTCLOCK LONG WordString STRING(50) SQ QUEUE,PRE() DISPLAYQ STRING(80) FPOINTER LONG END !------------------------------------------------------------------------- win WINDOW('..'),AT(,,293,193),ALRT(EscKey),TIMER(6),SYSTEM,GRAY,RESIZE,AUTO,MDI LIST,AT(3,4,287,123),USE(?List1),VSCROLL,FONT('Courier New',9,,FONT:regular),FORMAT('320L(1)@s80@'),FROM(SQ) PANEL,AT(43,136,196,17),USE(?Panel1),BEVEL(-1,-1) STRING(@s100),AT(47,140),USE(HOWLONG),COLOR(COLOR:Navy) ! or PINK or YELLOW STRING('..'),AT(11,160,189,10),USE(?WordString) BUTTON('Print'),AT(72,175,44,14),USE(?Print) BUTTON('Cancel'),AT(229,175,44,14),USE(?Cancel) BUTTON('Pause'),AT(124,175,44,14),USE(?Pauser),ICON(ICON:NONE) BUTTON('Edit'),AT(177,175,44,14),USE(?Change) END !--------------------------------------------------------------------------- INTIMER ROUTINE ! hit each timer firing (18/min ? about 6/100 secs) LOOP ! loop enough records for each timer firing. CASE CHECKER OF 1 IF RecsDone > RecsToDo CHECKER=0 DO Whatever ! when this process is finished EXIT ELSE DO FINDITEMS ! next(thisfile) RECSDONE +=1 IF CHECKER <> 1 ; EXIT . ! returnvalue from FindItems END OF 2 ! another process, or button, sets file, makes CHECKER=2 IF EOF(C) DO AnotherWhatever ! at end of this file SETCURSOR(CURSOR:ARROW) ?Change{PROP:HIDE}=0 CHECKER=0 EXIT END NEXT(C) ! access whatever ABC ? sorry RECSDONE +=1 bal:owing +=C:R ELSE ! exit, no action ?HOWLONG{PROP:WIDTH}=0 ?WordString{PROP:TEXT}='' EXIT END COUNTER +=1 IF COUNTER > 49 ! try to cycle enough records in each timer hit, value varies. COUNTER=0 TimeToGo"=FORMAT((RecsToDo-RecsDone)/((RecsDone/(CLOCK()-STARTCLOCK))*6000),@N6.1) ?WordString{PROP:TEXT}=CLIP(TimeToGo") &' more mins,' & RecsDone &' to '& RecsToDo ?HOWLONG{PROP:WIDTH}=INT(((?PANEL1{PROP:WIDTH}*0.97)* (RecsDone/RecsToDo))) EXIT END END -- Note: on 7/19/98, Arnor Baldvinsson posted a template that does this at Icetips /incoming a file called ProgExt.zip. It: allows you to: 1. Hide the progress window *) 2. Animate icons instead of using progress bar 3. Use solid fill progress bar instead of the block progress bar*) 4. Percent value controlled color of the filled progress bar.*) 5. Change the caption and text field on the progress window with your text and put field values into either/both. 6. Change the font and alignment of the text on the progress window 7. Post events to another thread with each percent when the progress window is hidden.*) *) - Only in the Clarion template for now. Printed December 3, 2024, 11:53 am This article has been viewed/printed 35200 times. |