Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
Par2: Progress during build 2003-03-20 -- Ben Kim !----------------------------------------------------------------
! In the DATA SECTION Before Window Declarations:
!----------------------------------------------------------------
FileRef &FILE
FileOpened BYTE
Progress1 LONG(0)
CurrentFile STRING(60)
!----------------------------------------------------------------
! Define a Window that shows progress bar
!----------------------------------------------------------------
ProgressWindow WINDOW('File Optimization Status Window. Please
Wait...'),AT(,,226,34),CENTER,GRAY,DOUBLE
STRING(@s60),AT(5,5,216,10),USE(CurrentFile),CENTER,FONT('Arial',10,COLOR:Na
vy,FONT:bold+FONT:italic)
PROGRESS,USE(Progress1),AT(5,18,216,10),RANGE(0,100)
END
!----------------------------------------------------------------
! Define a ROUTINE to pack the files
!----------------------------------------------------------------
PackFile ROUTINE
OPEN(ProgressWindow)
Progress1 = 0
CurrentFile = CENTER(CLIP(FileRef{PROP:Name}) & ': ' & Progress1 & '%
Completed',SIZE(CurrentFile))
DISPLAY()
ACCEPT
CASE EVENT()
OF EVENT:OpenWindow
DO ManageFile
OF EVENT:BuildFile
OROF EVENT:BuildKey
Progress1 = FileRef{PROP:Completed}
CurrentFile = CENTER(CLIP(FileRef{PROP:Name}) & ': ' & Progress1
& '% Completed',SIZE(CurrentFile))
DISPLAY()
OF EVENT:BuildDone
POST(EVENT:User)
OF EVENT:User
Progress1 = 100
CurrentFile = CENTER(CLIP(FileRef{PROP:Name}) & ': ' & Progress1
& '% Completed',SIZE(CurrentFile))
DISPLAY()
IF FileOpened = True
CLOSE(FileRef)
FileOpened = False
END
BREAK
OF EVENT:Accepted
POST(EVENT:User)
END
END
CLOSE(ProgressWindow)
EXIT
!----------------------------------------------------------------
! Define a ROUTINE to open file referenced exclusively
!----------------------------------------------------------------
ManageFile ROUTINE
FileOpened = False
OPEN(FileRef, 12h) !Open In Exclusive Access Mode
CASE ERRORCODE()
OF NoError
OROF BadKeyErr
FileOpened = True
SEND(FileRef,'FULLBUILD=on')
FileRef{PROP:ProgressEvents} = 100
PACK(FileRef)
Progress1 = FileRef{PROP:Completed}
CurrentFile = CENTER(CLIP(FileRef{PROP:Name}) & ': ' & Progress1 &
'% Completed',SIZE(CurrentFile))
DISPLAY()
OF NoFileErr
POST(EVENT:User)
ELSE
DO InvalidAccess
END
!----------------------------------------------------------------
! Handle Exceptions
!----------------------------------------------------------------
InvalidAccess ROUTINE
BEEP(BEEP:SystemExclamation)
MESSAGE('Could not open the file: ' & |
CLIP(FileRef{PROP:Name}) & '. ' & |
'Please be sure you are not running the system on
this or another PC.', |
'File Access Error', ICON:Exclamation, BUTTON:OK)
POST(EVENT:User)
!----------------------------------------------------------------
! Make calls to the PACKFILE ROUTINE to pack each file where ever you decide
(OK Accepted - or whatever)
!----------------------------------------------------------------
FileRef &= MyFile1
DO PackFile
FileRef &= MyFile2
DO PackFile
FileRef &= MyFile3
DO PackFile
FileRef &= MyFileX
DO PackFile
Today is November 21, 2024, 8:21 am This article has been viewed 35220 times.
|
|