Jim,
I wasn't going to post this code because - sometimes - it can look a bit
like "I can do this better than you can" syndrome and one-upmanship... It's
not intended to, mine is different not better!
I took your code and worked my way through it in conjunction with the manual
(R:Syntax) to see what you were doing so that I could use it myself - that's
how I discovered the width and lines settings. I guess I knew about them but
had never had any reason to use them or had just assumed that it was
impossible.
I've never liked using (CHAR(nnn)) and things like it if I can find a
suitable way around mainly because the code can become so hard for someone
else to follow (or for me to follow at a later date when I've forgotten what
I was doing <g>).
I did try to get a nice graphic "blob" rather than a group of characters but
nothing seems to give a "blob" in Windows - Dos is fine, but I guess that's
progress!
After a while I came up with the following. I've purposely done things the
long way round so that I could see what was going on and added the comments
so that I might remember at a later date. There are a number of variables
that I use in all my coding so they don't get cleared at the end (and
vPause_Pos is defined at the start as I use that everywhere to give a
constant position and one that can easily be changed application-wide) There
are also additional pauses so that you can see the start and finish clearly.
I'm not 100% happy with the choice of the bar characters but until I find
some better combination...
CLS
CLEAR ALL VAR
SET VAR vPause_Pos TEXT = 'AT 6 6'
SET VAR vNumberRecords INTEGER = NULL -- OBTAIN FROM MAX(COLNAME)
SET VAR vIncrement INTEGER = NULL -- Number of records divided by 50 -
2% steps
SET VAR vPerCent INTEGER = NULL -- used for text value in message
SET VAR vNextUpdate INTEGER = NULL -- number of records per 2%
increments
SET VAR vBarNum INTEGER = NULL -- position number in the bar
SET VAR vBarCharY TEXT = NULL -- Unprocessed data visual
representation
SET VAR vBarCharN TEXT = NULL -- Processed data visual
representation
SET VAR vMessageL1 TEXT = NULL -- Message line 1 for ease of setting
pause width value
SET VAR vMessageL2 TEXT = NULL -- Message line 2 for ease of setting
pause width value
SET VAR vPerCent = 0 -- Initially zero, incremented in steps of 2
SET VAR vRecCount = 0 -- Initially zero, direct count of records
processed
SET VAR vBarNum = 0 -- Initially zero, determines position of
indicator in bar
SET VAR vNumberRecords = 500 -- (MAX(ColName)
SET VAR vIncrement = (INT(.vNumberRecords / 50)) -- to give a 50
character bar
SET VAR vNextUpdate = .vIncrement
SET VAR vBarCharN = (SFIL( '<', (50 - .vBarNum) ))
SET VAR vBarCharY = (SFIL( '>', .vBarNum))
SET VAR vMessageL1 = ('Data completed progress indicator :' &
(CTXT(.vPerCent)) + '% completed') -- Note additional space!
SET VAR vMessageL2 = (.vBarCharY + '*' + .vBarCharN)
SET VAR vPauseMes = (.vMessageL1 & .vMessageL2)
SET VAR vCaption = 'Processing data - please wait...'
PAUSE 3 USING .vPauseMes=75 CAPTION .vCaption &vPause_Pos
pause for 2
WHILE vRecCount <= .vNumberRecords THEN
SET VAR vRecCount = (.vRecCount + 1)
IF vNextUpdate = (.vRecCount) THEN
SET VAR vBarNum = (.vBarNum + 1)
SET VAR vPerCent = (.vPerCent + 2)
SET VAR vNextUpdate = (.vNextUpdate + .vIncrement)
SET VAR vBarCharN = (SFIL( '<', (50 - .vBarNum) ))
SET VAR vBarCharY = (SFIL( '>', .vBarNum))
SET VAR vMessageL1 = ('Data completed progress indicator:' &
(CTXT(.vPerCent)) + '% completed') -- Additional space no longer needed
SET VAR vMessageL2 = (.vBarCharY + '*' + .vBarCharN)
IF vPerCent = 100 THEN
SET VAR vCaption = 'Data Processing'
SET VAR vPauseMes = 'Processing Completed'
PAUSE 3 USING .vPauseMes CAPTION .vCaption &vPause_Pos
ELSE
SET VAR vPauseMes = (.vMessageL1 & .vMessageL2)
PAUSE 4 USING .vPauseMes=75 CAPTION .vCaption
ENDIF
pause for 1
ENDIF
ENDWHILE
CLEAR VAR
vNumberRecords,vIncrement,vPerCent,vNextUpdate,vBarNum,vMessageL1,vMessageL2
,vBarCharY,vBarCharN,vRecCount,vPauseMes
--CLS
RETURN
Take and use at will, anybody,
Regards,
Alastair.
----- Original Message -----
From: "Jim Limburg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 19, 2002 8:47 PM
Subject: Re: PAUSE 4 and Screen Flicker
> Alastair
>
> I've been told I can't do that alot, but I do it anyway... he,he..
> I am like you, I don't understand what the HTML USING 'message'
> RSyntax is saying.. With the example I am showing the =w doesn't
> change anything, nor can I figure out what it actually does. I did
> some more testing and found in the example I have done only lets me
> have a max of 28 char in the first line and the second line has to
> be one more that whatever is in the first line. I guess to match up
> the 28 plus whatever char is holding the last position which I think
> might be the char(13)... ??? Anywho -- check out my latest rendition
> that I am going to post under David Blockers reply..
>
> Thanks for the good feedback, and thought process.
> Jim Limburg
>
> --- Alastair Burr <[EMAIL PROTECTED]> wrote:
> > This is very neat, Jim - I like the Carriage Return/Line Feed idea a
lot -
> > but according to R:Syntax you can't do it!!
> >
> > According to the entry for pause (pasted as is):
> >
> > USING 'message'
> > Displays the specified message in a Windows dialog box, or on line 25
for
> > DOS. The maximum width of message text in an R:BASE dialog box is 68
> > characters and the maximum number of lines is 15. The maximum width of
> > message text in a Windows dialog box is 77 characters and is limited to
one
> > line.
> >
> > and
> >
> > =w
> > Specifies a width for the pause dialog box. R:BASE for Windows only.
> >
> > There is a whole lot of confusion here (and, by the way, the "using"
entry
> > is repeated if anyone at RBTI wants to know and correct it):
> >
> > First of all the maximum width is stated as 68 characters and lines as
15
> > with neither Dos nor Windows specified then for Window only it is
> > re-specified as 77 characters and 1 line maximum. So which is it?? Does
the
> > 77 refer the maximum LENGTH of the message?
> >
> > If you use the width clause it will only re-size the box down for your
> > message and not up. For example, if your message is 40 characters long
then
> > you can specify w=20 and get 2 lines of 20 characters but you cannot set
> > w=60 and get one line of 60 characters' length with 20 empty spaces. If
this
> > is how it's meant to be then the "manual" should say so but, if you
could
> > extend the box this way some, but not all, of the problems discussed
> > recently would probably be resolved.
> >
> > One other thing, does anybody else think it odd that the message in the
> > Windows box appears on line 2 of 5 rather than 3 of 5 or, even, 2 of 3
using
> > the specified single line of message? Why does the box need to be so
big?
> > Should there be a LINES parameter?
> >
> > Perhaps someone who is on the v7 beta test roster can say whether the
pause
> > command is re-vamped in any way in that version as it is pointless to
harp
> > on about it now if changes have already been made.
> >
> > Regards,
> > Alastair.
> >
> >
> > ----- Original Message -----
> > From: "Jim Limburg" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, June 17, 2002 7:46 PM
> > Subject: RE: PAUSE 4 and Screen Flicker
> >
> >
> > > Javier, David
> > >
> > > I have done a bit of tweaking myself to this cool code..
> > > Run this in a Win version and watch the results..
> > > I have found a balance between the vmsg, & the vmsg1
> > > variables to let me have just the right size message box
> > > and still get the message to change on the second line.
> > > One space larger or smaller throws this out of kilter.
> > > or using a bar representation character that has a larger
> > > pixel representation will throw chunks as well, but hey
> > > it works.
> > >
> > > CLS
> > > SET VAR vnr INTEGER
> > > SET VAR vinc INTEGER
> > > SET VAR von INTEGER
> > > SET VAR vpct INTEGER
> > > SET VAR vno_recs = 100000
> > > SET VAR vm_crlf TEXT = ((CHAR(13)) + (CHAR(10)))
> > > SET VAR vmsg = 'Processing .. PLEASE WAIT'
> > > SET VAR vmsg1 = 'Processing .. PLEASE WAIT' + .vm_crlf + +
> > > ' .'
> > > PAUSE 3 USING .vmsg1 AT 5 10
> > > --'Going from 1 to 100,000 by 2 pct incr / a bargraph display' AT 5 10
> > > SET VAR vinc = (.vno_recs / 50)
> > > SET VAR vnr = .vinc
> > > SET VAR vbar = ' '
> > > SET VAR von = 0
> > > SET VAR vpct = 2
> > >
> > > WHILE von < .vno_recs THEN
> > > SET VAR von = (.von + 1)
> > > IF vnr = .von THEN
> > > -- Use a character other that 62 to display a different bar style
> > > --SET VAR vbar = ( .vbar + (CHAR(124)) ) --| pipe
> > > --SET VAR vbar = ( .vbar + (CHAR(22)) ) --Good-one horizontal bar
> > shaped
> > > --in dos, but pipe in win
> > version
> > > --SET VAR vbar = ( .vbar + (CHAR(93)) ) --]
> > > SET VAR vbar = ( .vbar + (CHAR(91)) ) --[
> > > SET VAR vmessage = ( (CTXT(.vpct)) + '% ' + .vbar )
> > > WRITE .vmessage AT 20 2
> > > SET VAR vmessage = (.vmsg + .vm_crlf + .vmessage)
> > > PAUSE 4 USING .vmessage
> > > SET VAR vpct = (.vpct + 2)
> > > SET VAR vnr = (.vnr + .vinc)
> > > ENDIF
> > > ENDWHILE
> > > CLEAR VAR vnr,vinc,von,vpct,vno_recs,vbar,vmessage
> > > --CLS
> > > RETURN
> > >
> > > Jim Limburg
> > >
> > > --- Javier Valencia <[EMAIL PROTECTED]> wrote:
> > > > David:
> > > > Thank you for cleaning up the code. It is nice to be able to
contribute
> > to
> > > > the List considering how much benefit I have gotten from it. I just
have
> > to
> > > > figure out how to display the solid block on the completion bar;
> > although I
> > > > have a hunch that version 7 may have bigger and better answers. By
the
> > way,
> > > > were you able to resolve the screen flicker problem?
> > > >
> > > > Javier Valencia, PE
> > > > President
> > > > Valencia Technology Group, L.L.C.
> > > > 14315 S. Twilight Ln., Suite #14
> > > > Olathe, KS 66062-4571
> > > > (913)829-0888
> > > > (913)649-2904 FAX
> > > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On
> > > > Behalf Of David M. Blocker
> > > > Sent: Sunday, June 16, 2002 3:35 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: PAUSE 4 and Screen Flicker
> > > >
> > > > Javier
> > > >
> > > > Thanks for sharing these. I've made a few minor adjustments for
making
> > them
> > > > useful for teaching and here they are:
> > > >
> > > > David Blocker
> > > >
> > > >
> >
*(**************************************************************************
> > > > ********************
> > > > ** FILENAME: PAUSE4A.RMD
> > > > ** CREATED BY: Javier Valencia; posted on R:Base List server
> > > > ** 6/15/2002
> > > > ** PURPOSE: Demonstrate PAUSE 4 vs. WRITE command: automatically
> > > > rewrites in
> > > > ** last PAUSE 3 box; counter bar for
looping
> > > > programs!
> > > > ** DATE CREATED: 06/16/2002
> > > > ** LAST UPDATE:
> > > >
> >
****************************************************************************
> > > > *****************)
> > > >
> > > > -- QUICK CODE TO SHOWS PERCENT AND PROGRESS BAR FOR A COUNTER
> > > > CLS
> > > > SET VAR vnr INTEGER
> > > > SET VAR vinc INTEGER
> > > > SET VAR von INTEGER
> > > > SET VAR vpct INTEGER
> > > > SET VAR vno_recs = 100000
> > > > PAUSE 3 USING 'Counting from 1 to 100,000 by 2 pct increments with +
> > > > a bargraph display' AT 5 10
> > > > SET VAR vinc = (.vno_recs / 50)
> > > > SET VAR vnr = .vinc
> > > > SET VAR vbar = ' '
> > > > SET VAR von = 0
> > > > SET VAR vpct = 2
> > > >
> > > > WHILE von < .vno_recs THEN
> > > > SET VAR von = (.von + 1)
> > > >
> > > > IF vnr = .von THEN
> > > > -- Use a character other that 62 to display a different bar
style
> > > > set var vbar = ( .vbar + (CHAR(62)) )
> > > > set var vmessage = ( (CTXT(.vpct)) + ' % - ' + .vbar )
> > > > write .vmessage at 20 2
> > > > pause 4 using .vmessage
> > > > set var vpct = (.vpct + 2)
> > > > set var vnr = (.vnr + .vinc)
> > > > ENDIF
> > > > ENDWHILE
> > > > CLEAR VAR vnr,vinc,von,vpct,vno_recs,vbar,vmessage
> > > > RETURN
> > > >
> > > >
> > > >
> >
*(**************************************************************************
> > > > ********************
> > > > ** FILENAME: PAUSE4E.RMD
> > > > ** CREATED BY: Javier Valencia posted on R:Base List server
> > > > ** 6/15/2002
> > > > ** PURPOSE: Demonstrate PAUSE command vs. WRITE command : show
255
> > > > ** different characters to use for
counter
> > > > percentage done bars.
> > > > ** great for looping programs!
> >
> === message truncated ===
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
> ================================================
> TO SEE MESSAGE POSTING GUIDELINES:
> Send a plain text email to [EMAIL PROTECTED]
> In the message body, put just two words: INTRO rbase-l
> ================================================
> TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
> In the message body, put just two words: UNSUBSCRIBE rbase-l
> ================================================
> TO SEARCH ARCHIVES:
> http://www.mail-archive.com/rbase-l%40sonetmail.com/
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/