Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bug with beautify
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00542537
Message ID:
00546444
Vues:
19
This message has been marked as a message which has helped to the initial question of the thread.
The way your code is written, the progress bar is not going to get to 100% unless your data just happens to contain an even multiple of 100 records. Run the following code to demonstrate
ox = createobject("progbar")
ox.show()

*	Demonstrate that 100% shows correctly.
ox.SetRange( 0, 10000)
ox.SetPos( 10000)
wait window "Progress bar shows 100%"

*	This will never reach 100%
ox.Reset()
lnReccount = 9999	&& Or any number between 9901 and 9999
ox.SetRange( 0, lnReccount)	
ox.SetPos( 0)
FOR lni = 1 to lnReccount
   if mod( lni, 100) = 0
   	ox.SetPos( lni)
   endif
ENDFOR &&* lni = 1 to 10000
wait window "Progress bar shows 99%"

ox = null
release ox


>Hi again Rick,
>
>I implemented your ProgBar in my form, I made couple of modifications in it (minor: changed color of the upper label to blue, made height smaller and width bigger, etc., used the latest version of CommCtrl, though after some experiencing I left label position as 2). Unfortunately, it showed the similar problems, we had with our class, though it seems to work faster and looks nicer, in my opinion.
>For instance, it doesn't immediately release (e.g. stays on form until data are saved) and it doesn't show 100%. The last one is 99%, though I tried to explicitly call UpdatePercent method (I made it public for this purpose).
>
>Here is my code in thisform.doProcess method. I finally was able to release progress bar immediatelly (Note, wait window between locscreens, I tried sleep function before, but it didn't give me the desired effect), but it still shows 99% before releasing. May be you can see some problems here:
>
>curEsc = set ('escape')
>lcOnEsc=on('escape')
>set escape on
>llEsc= .f.
>on escape llEsc = .t.
>oProgBar = newobject('ProgBar','progbar.vcx')
>*!*	oProgBar.SetMessageFont('Arial', 8)
>*!*	oProgBar.SetTitleFont('Courier New', 8)
>oProgBar.SetTitle('Calculating progress for:'+m.lcTitle)
>oProgBar.SetMessage('File '+dbf('BldMstr'))
>oProgBar.SetRange(0, m.lnReccount)
>oProgBar.show()
>*!*	loTherm = newobject("thermometer", "wg","","Calculating Progress for:" + m.lcTitle, ;
>*!*		m.lnReccount)
>*!*	loTherm.show()
>with thisform
>	.lockscreen=.t.
>
>	scan
>		if m.llEsc and .NiceEsc()
>			exit
>		else
>			llEsc = .f.
>		endif
>		lnCount=m.lnCount+1
>*oProgBar.StepIt()
>* -- Updating the percentage bar
>		if mod(m.lnCount,100) = 0 && or (m.lnCount>=m.lnReccount-10)
>*loTherm.update(m.lnCount)
>			oProgBar.SetPos(m.lnCount)
>			set message to '     Record #'+transform(m.lnCount) + m.lcMsgTail
>		endif
>        if m.lnCount=m.lnReccount
>            oProgBar.UpdatePercent()
>        endif
>		do case
>		case m.tcMode = "Parse Situs"
>			.ProcParse(m.tcMode, m.llProgramExists)
>
>		case m.tcMode = 'Parse Owner'
>			.ProcParse(m.tcMode, m.llProgramExists)
>
>		case m.tcMode = 'ResOwner'
>			.ProcResOwner()
>
>		case m.tcMode='Auto Situs'
>			.AutoAddrSitus()
>
>		case m.tcMode='Auto Owner'
>			.AutoAddrOwner()
>		endcase
>	endscan
>	set message to 'Process is complete...'
>	oProgBar.release()
>	release oProgBar
>	.lockscreen=.f.
>*!*	loTherm.complete()
>*!*		if vartype(loTherm)='O'
>*!*			loTherm.release()
>*!*		endif
>*!*		release loTherm	
>    wait window timeout 1 ""
>*    = Sleep(1000) && Wait 1 second
>	.lockscreen=.t.
>	set message to 'Process is complete... Wait while saving data..'
>	wait window nowait set('message',1)
>	select Bldmstr
>	set relation to 		&& RMM 09/06/00
>	if m.curEsc='ON'
>		set escape on 	&& rmm 09/13/00
>	else
>		set escape off
>	endif
>	on escape &lcOnEsc
>	if !m.llEsc
>		lnHCursor = LoadCursor(0, IDC_WAIT)
>* Get the old cursor
>		lnOldCursor = SetCursor(m.lnHCursor)
>		if not .editmode		&& If already in Editmode then Just Save
>			.navstand.cmdEdit.click()		&& In Edit Mode
>		endif
>		.add() && Save changes
>	endif
>	if !empty(m.lcOrder)
>		set order to (m.lcOrder)
>	endif
>	if empty(.FilterStr)
>		goto m.lnRecno
>	else
>		go top
>	endif
>	.grdBldMstr.setfocus()
>	.lockscreen=.f.
>* Restore old cursor
>	lnOldCursor = SetCursor(m.lnOldCursor)
>	wait clear
>endwith
>return !m.llEsc
Rick Borup, MCSD

recursion (rE-kur'-shun) n.
  see recursion.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform