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 14:44:55
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Class works great in VFP7 but not in VFP8
Divers
Thread ID:
00877235
Message ID:
00877235
Vues:
69
Update: I just noticed that the loop does not exit as it should if the user presses ALT+F10...

I have some prgs that call this progress bar and it works great in VFP7 but in VFP8 the progress bar form displays but an hour glass shows and the progress bar itself on the form never seems to appear or change. It's as if the form never completely displays even when updating it. In fact you cannot even see the progress bar or label on the progressbar form only an outline of the form appears in VFP8. When the process finishes it releases the form as it should. The code is identical in both versions (VFP7 and VFP8) with no modifications. The only difference is that the app has been compiled in VFP8. Any idea what is causing this or how to fix it so the progress bar displays correctly? The showwindow property was 1 originally but I changed it to 2 for testing purposes to see if that would help to no avail...

This progress bar is called just like below in 3 separate places and in ALL places it behaves the same in the two VFP versions. Works in VFP7 but not in VFP8...

Here is a code snippet from the .prg:
al3_file="\PROGRAM FILES\IVANS\TRANSMAN\AIDOWN\POLDATA.001" && or whatever
Y=0
mrectot = RECCOUNT('IVANS_p')  && we are stepping thru this table
lnrep = 0
oprogress = CREATEOBJECT('therm',mrectot+3,al3_file)
oprogress.CAPTION = "IVANS TRANSFER - Processing Policies"
oprogress.VISIBLE = .T.

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

SELECT IVANS_P
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: "+IVANS_i.po_name
   oprogress.updatetherm(Y)
   *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

RETURN

PROCEDURE abortall
   llabortall = .T.
RETURN

DEFINE CLASS therm AS FORM

   HEIGHT = 87
   WIDTH = 328
   SHOWWINDOW = 2
   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"
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform