Page 1 of 3

Progress bar from XbpPack2

Posted: Mon Jan 03, 2011 7:48 pm
by rdonnay
Here is a program that uses the XbpPack2.Dll provided to Xbase++ subscribers from Alaska Software.

This dll contains a new class: XbpProgressBar.

I have created a sample program that shows how to use this class in eXpress++ applications.
This sample program includes a new class named WaitProgress that you can use as a replacement for DC_WaitOn() and for other uses.

Create a new folder named \exp19\samples\XbpPack and unzip the attached files in that folder, then run pbuild Progress.xpj.

Code: Select all

FUNCTION Main()

LOCAL GetList[0]

@ 0,0 DCPUSHBUTTON CAPTION 'Standard Please Wait Progress Bar' ;
      SIZE 40,2 ACTION {||PleaseWait( 5 )}

@ 2,0 DCPUSHBUTTON CAPTION 'Backup Files Progress Bar' ;
      SIZE 40,2 ACTION {||Backup(.f.)}

@ 4,0 DCPUSHBUTTON CAPTION 'Backup Files Progress Bar (w/cancel button)' ;
      SIZE 40,2 ACTION {||Backup(.t.)}

DCREAD GUI FIT TITLE 'Progress Bars' SETAPPWINDOW

RETURN nil

* -------------

FUNCTION PleaseWait( nSeconds )

LOCAL oProgress, i

DEFAULT nSeconds := 2

oProgress := WaitProgress():new()
oProgress:messageString := 'Doing some stuff. Please Wait...'
oProgress:title := 'Doing Stuff'
oProgress:progressStyle := XBPPRGR_STYLE_MARQUEE
oProgress:create()
FOR i := 1 TO nSeconds * 10
  DC_CompleteEvents() // need this to move window
  Sleep(10)
NEXT
oProgress:destroy()

RETURN nil

* -------------

FUNCTION Backup( lCancelButton )

LOCAL oProgress, aDir, i, j

DEFAULT lCancelButton := .f.

oProgress := WaitProgress():new()
oProgress:messageString := 'Backing up files. Please Wait...'
oProgress:title := 'File Backup'
oProgress:isCancelButton := lCancelButton

oProgress:create()

aDir := Directory()
FOR i := 1 TO Len(aDir)
  oProgress:setData(0)
  oProgress:statusObject:setCaption(aDir[i,1])
  oProgress:progressObject:maximum := aDir[i,2]
  FOR j := 1 TO aDir[i,2] STEP 200 // need this to move window
    oProgress:setData( j )
    DC_CompleteEvents()
    IF oProgress:isCancelled
      EXIT
    ENDIF
  NEXT
  IF oProgress:isCancelled
    EXIT
  ENDIF
NEXT

oProgress:destroy()

RETURN nil

Re: Progress bar from XbpPack2

Posted: Tue Jan 04, 2011 3:57 am
by hz_scotty
Backup files progress bar and the function with the ESC

1.the bar, from 2 file to end of files, will not begin from 1 count
(it stays after 1 file always on the end of the progress bar! by me)
only you switch to another application and return back to progress bar
then the bar goes to right ( i think there is a refresh or reset value problem)

2. XbpPack2.ch is not in your package ;)

best regards

Re: Progress bar from XbpPack2

Posted: Tue Jan 04, 2011 4:10 am
by Tom
XbpPack2.ch is not in your package
xbpack2.ch/.dll are parts of the xbpack2-package, which you need to load from Alaska Software.

Re: Progress bar from XbpPack2

Posted: Tue Jan 04, 2011 9:23 am
by rdonnay
I don't understand your comment about the backup progress.

It works perfectly for me.

Re: Progress bar from XbpPack2

Posted: Tue Jan 04, 2011 10:23 am
by hz_scotty
Zwischenablage01.jpg
Zwischenablage01.jpg (204.84 KiB) Viewed 24720 times
Zwischenablage02.jpg
Zwischenablage02.jpg (205.84 KiB) Viewed 24720 times
on the first screen you see the progress bar - thats ok
when the first copy is finish the name of the second file is changed under the progress bar
but the progress bar is not reset (and begin from left to right) it stay's full on the right position (see Pic.2)

but when you change the focus to desktop (klick once on desktop with the mouse)
and then change the focus to your backupwindow the progress bar is show correct until the next file is come

i checked ist on a Win XP SP3 and on a Win Vista SP2 Computer

on both are the same mistake

hope i could help to understand

Re: Progress bar from XbpPack2

Posted: Tue Jan 04, 2011 10:55 am
by rdonnay
Ok, now I understand.
I never tested it without a manifest file on XP or under Windows 7 without the manifest.

That behavior appears to happen only on XP without a manifest.

Copy the file \exp19\lib\manifest.xml to a file named Progress.Exe.Manifest.

I will try to determine why this is happening.

Re: Progress bar from XbpPack2

Posted: Tue Jan 04, 2011 11:25 am
by hz_scotty
with the "manifest file" it works on WIN XP Sp3 :clap:
the progess bar now looks other - as bar not as small boxes

on VISTA with SP2 its the same problem
it is equal if there is a "manifest file"
the progress bar has small boxes and will not reset

Re: Progress bar from XbpPack2

Posted: Tue Jan 04, 2011 3:36 pm
by BruceN
There's something on Alaska's page re this:

http://news.alaska-software.com/readmes ... .bugreport

I've had problems with msnifst files on vista/7 so I stopped using them. I'll stick to Roger's dc_waiton. Better support, less problems (better taste, less filling?)

bruce

Re: Progress bar from XbpPack2

Posted: Tue Jan 04, 2011 10:59 pm
by Auge_Ohr
hi,

we did have that Thema in 2006 with ActivX an Progressbar from MsComCtl.OCX

depend on OS() ( Vista / Win7 ) you can see Progress Marquee Effect
Marquee Effect
Marquee Effect
Marquee.JPG (57.07 KiB) Viewed 24697 times
see also how Class Style and Class Part belong to it when using "visual Style"
(sometimes you have to switch between Version 5 and Version 6 to get Effect )

Re: Progress bar from XbpPack2

Posted: Thu Jan 06, 2011 12:19 pm
by hz_scotty
i like to display the process bar for "index on" or "reindex" with the XbpPack2

at this time i use DCPROGRESS in my Application

but when i need this for many Index (programmstart/reindex) the window flicker
so i like to chance it to the new XbpPack2 to display it like the demo from roger

Code: Select all

    
FOR j := 1 TO aDir[i,2] STEP 200 // need this to move window
    oProgress:setData( j )
    DC_CompleteEvents()
    IF oProgress:isCancelled
        EXIT
    ENDIF
NEXT

IF oProgress:isCancelled
   EXIT
ENDIF

can anybody show me some code for a process bar for indexing with XbpPack2?


many thanks for help