Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Class works great in VFP7 but not in VFP8
Message
De
13/02/2004 15:48:43
 
 
À
13/02/2004 14:44:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00877235
Message ID:
00877272
Vues:
15
Here is program that works as it is as a test to demonstrate the problem. It works in VFP7 but not in VFP8:
*TESTHERM.PRG
CLEAR
CLOSE ALL
SET SAFETY OFF

CREATE TABLE JUNKDBF (cvalue c(10))

FOR i = 1 TO 30
	APPEND BLANK
	REPLACE cvalue WITH ALLTRIM(STR(i))
ENDFOR

al3_file="whatever" && or whatever
Y=0
mrectot = RECCOUNT('junkdbf')  && we are stepping thru this table
lnrep = 0
oprogress = CREATEOBJECT('therm',mrectot,al3_file)
oprogress.CAPTION = "Processing..."
oprogress.VISIBLE = .T.

llabortall = .F.
ON KEY LABEL ALT+F10 DO abortall

SELECT junkdbf

GO TOP

SCAN
   IF llabortall  && this works in VFP7 too but not in VFP8 for some reason
      EXIT
   ENDIF
   lnrep = lnrep + 1
   y = lnrep
   oprogress.label2.CAPTION="Processing: "+junkdbf.cvalue
   oprogress.updatetherm(Y)
	DOEVENTS
	oprogress.refresh()
	ia = 0
	FOR Ia = 1 TO 10000000
	ENDFOR
   *adding oprogress.draw() or .refresh() here doesn't seem to make any difference
   *--Processing takes place here
ENDSCAN
*MORE STUFF ETC

IF TYPE('oprogress')="O" .and. !ISNULL(oprogress)
   oprogress.RELEASE()
ELSE
   oprogress=.NULL.
   RELEASE oprogress
ENDIF

USE IN JUNKDBF

ON KEY LABEL ALT+F10

RETURN

PROCEDURE abortall
   llabortall = .T.
RETURN

DEFINE CLASS therm AS FORM

   HEIGHT = 120
   WIDTH = 328
   SHOWWINDOW = 1
   DOCREATE = .T.
   AUTOCENTER = .T.
   BORDERSTYLE = 2
   CAPTION = ""
   CONTROLBOX = .F.
   CLOSABLE = .F.
   MAXBUTTON = .F.
   MINBUTTON = .F.
   MOVABLE = .F.
   *-- Denominator used to define the width of the bar and the label
   n_denominator = 0
   NAME = "therm"


   ADD OBJECT backshape AS SHAPE WITH ;
      TOP = 36, ;
      LEFT = 15, ;
      HEIGHT = 34, ;
      WIDTH = 300, ;
      BACKSTYLE = 1, ;
      BORDERSTYLE = 0, ;
      BACKCOLOR = RGB(255,255,255), ;
      NAME = "Backshape"


   ADD OBJECT label1 AS LABEL WITH ;
      FONTBOLD = .T., ;
      FONTNAME = "MS Sans Serif", ;
      ALIGNMENT = 2, ;
      CAPTION = "Label1", ;
      HEIGHT = 18, ;
      LEFT = 117, ;
      TOP = 45, ;
      WIDTH = 93, ;
      TABINDEX = 2, ;
      FORECOLOR = RGB(0,0,255), ;
      BACKCOLOR = RGB(255,255,255), ;
      NAME = "Label1"


   ADD OBJECT foreshape AS SHAPE WITH ;
      TOP = 37, ;
      LEFT = 15, ;
      HEIGHT = 32, ;
      WIDTH = 0, ;
      BACKSTYLE = 0, ;
      BORDERSTYLE = 0, ;
      DRAWMODE = 10, ;
      FILLSTYLE = 0, ;
      BACKCOLOR = RGB(255,255,255), ;
      FILLCOLOR = RGB(0,0,255), ;
      NAME = "ForeShape"


   ADD OBJECT text1 AS TEXTBOX WITH ;
      BACKSTYLE = 0, ;
      HEIGHT = 38, ;
      LEFT = 12, ;
      TOP = 33, ;
      WIDTH = 304, ;
      NAME = "Text1"


   ADD OBJECT label2 AS LABEL WITH ;
      AUTOSIZE = .T., ;
      FONTNAME = "MS Sans Serif", ;
      FONTSIZE = 8, ;
      CAPTION = "Processing...", ;
      HEIGHT = 15, ;
      LEFT = 14, ;
      TOP = 11, ;
      WIDTH = 63, ;
      NAME = "Label2"


   *-- Update thermometer
   PROCEDURE updatetherm
      LPARAMETER p_newnumer
      LOCAL n_pct, n_barwidth
      n_pct = (p_newnumer / THISFORM.n_denominator)
      IF n_pct > 1
      	n_pct = 1
      ENDIF
      n_barwidth = INT(300 * n_pct)
      THISFORM.foreshape.WIDTH = n_barwidth
      THISFORM.label1.CAPTION = TRANSFORM(ROUND(n_pct * 100, 0), '###%')
      THISFORM.REFRESH

   ENDPROC


   PROCEDURE INIT
      LPARAMETERS pn_denom, pc_msg
      LOCAL n_args
      n_args = PARAMETERS()
      THIS.label1.CAPTION = '0%'
      THISFORM.n_denominator = pn_denom
      IF n_args = 2
         THISFORM.label2.CAPTION = pc_msg
      ENDIF
   ENDPROC


   PROCEDURE text1.WHEN
      RETURN .F.
   ENDPROC


ENDDEFINE
*
*-- EndDefine: therm
**************************************************
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform