RandyDeWitt
IS-IT--Management
Hello,
I am shamelessy trying to expand upon Marcia Akins code sample for an odometer in her 1001 Things you wanted to Know about Visual Foxpro.
I created a container class that holds the update method from her tbrprog class then place that object on my form. I execute it using,
IF MOD(lnCnt,10) = 0
thisform.objodometer.Update( INT((lnCnt/lnTotal)*100), 'Processing # ' + PADL(lnCnt,3))
ENDIF
lnCnt = lnCnt + 1
My problem is, when the shape covers the % Complete label, her label turns white and remains visible, while mine stays blue and gets covered by the ever widening shape.
How do I make my label go from blue to white when it is covered by the shape?
Here is the code for my new class. Thanks in advance for any assistance and thanks to Marcia for providing the framework.
**************************************************
*-- Class: xcntodo (c:\projects\common\class\genclass.vcx)
*-- ParentClass: xcntstd (c:\projects\common\class\genclass.vcx)
*-- BaseClass: container
*-- Time Stamp: 03/23/06 11:32:06 AM
*
DEFINE CLASS xcntodo AS xcntstd
Width = 304
Height = 49
BorderWidth = 0
Name = "xcntodo"
ADD OBJECT lbltitle AS xlblstd WITH ;
AutoSize = .T., ;
Caption = "Not started.", ;
Height = 17, ;
Left = 0, ;
Top = 0, ;
Width = 65, ;
Name = "lbltitle"
ADD OBJECT txtoutline AS xtxtstd WITH ;
BackStyle = 1, ;
BorderStyle = 1, ;
Enabled = .F., ;
Height = 22, ;
Left = 0, ;
Top = 24, ;
Width = 302, ;
Style = 0, ;
Name = "txtoutline"
ADD OBJECT shpodometer AS xshpstd WITH ;
Top = 24, ;
Left = 0, ;
Height = 19, ;
Width = 0, ;
BackStyle = 1, ;
BorderStyle = 1, ;
BorderWidth = 0, ;
DrawMode = 10, ;
SpecialEffect = 0, ;
BackColor = RGB(0,0,255), ;
BorderColor = RGB(0,0,255), ;
Name = "shpodometer"
ADD OBJECT lblpercent AS label WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
Caption = "0%", ;
Height = 17, ;
Left = 139, ;
Top = 28, ;
Width = 20, ;
ColorSource = 4, ;
ColorScheme = 1, ;
ForeColor = RGB(0,0,255), ;
Name = "lblPercent"
*-- Displays progress bar
PROCEDURE update
LPARAMETERS tnNewVal, tcText
thisform.LockScreen = .T.
WITH this
*** Update Progress Bar
tnNewVal = IIF(tnNewVal < 0, 0, IIF(tnNewVal > 100, 100, tnNewVal))
.lblPercent.Caption = LTRIM(str(tnNewVal) + '%')
.shpodometer.Width = (3 * tnNewVal)
*** Check Title
IF TYPE( "tcText" ) = "C" AND ! EMPTY( tcText )
.lblTitle.Caption = tcText
ENDIF
ENDWITH
thisform.LockScreen = .F.
ENDPROC
ENDDEFINE
*
*-- EndDefine: xcntodo
**************************************************
I am shamelessy trying to expand upon Marcia Akins code sample for an odometer in her 1001 Things you wanted to Know about Visual Foxpro.
I created a container class that holds the update method from her tbrprog class then place that object on my form. I execute it using,
IF MOD(lnCnt,10) = 0
thisform.objodometer.Update( INT((lnCnt/lnTotal)*100), 'Processing # ' + PADL(lnCnt,3))
ENDIF
lnCnt = lnCnt + 1
My problem is, when the shape covers the % Complete label, her label turns white and remains visible, while mine stays blue and gets covered by the ever widening shape.
How do I make my label go from blue to white when it is covered by the shape?
Here is the code for my new class. Thanks in advance for any assistance and thanks to Marcia for providing the framework.
**************************************************
*-- Class: xcntodo (c:\projects\common\class\genclass.vcx)
*-- ParentClass: xcntstd (c:\projects\common\class\genclass.vcx)
*-- BaseClass: container
*-- Time Stamp: 03/23/06 11:32:06 AM
*
DEFINE CLASS xcntodo AS xcntstd
Width = 304
Height = 49
BorderWidth = 0
Name = "xcntodo"
ADD OBJECT lbltitle AS xlblstd WITH ;
AutoSize = .T., ;
Caption = "Not started.", ;
Height = 17, ;
Left = 0, ;
Top = 0, ;
Width = 65, ;
Name = "lbltitle"
ADD OBJECT txtoutline AS xtxtstd WITH ;
BackStyle = 1, ;
BorderStyle = 1, ;
Enabled = .F., ;
Height = 22, ;
Left = 0, ;
Top = 24, ;
Width = 302, ;
Style = 0, ;
Name = "txtoutline"
ADD OBJECT shpodometer AS xshpstd WITH ;
Top = 24, ;
Left = 0, ;
Height = 19, ;
Width = 0, ;
BackStyle = 1, ;
BorderStyle = 1, ;
BorderWidth = 0, ;
DrawMode = 10, ;
SpecialEffect = 0, ;
BackColor = RGB(0,0,255), ;
BorderColor = RGB(0,0,255), ;
Name = "shpodometer"
ADD OBJECT lblpercent AS label WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
Caption = "0%", ;
Height = 17, ;
Left = 139, ;
Top = 28, ;
Width = 20, ;
ColorSource = 4, ;
ColorScheme = 1, ;
ForeColor = RGB(0,0,255), ;
Name = "lblPercent"
*-- Displays progress bar
PROCEDURE update
LPARAMETERS tnNewVal, tcText
thisform.LockScreen = .T.
WITH this
*** Update Progress Bar
tnNewVal = IIF(tnNewVal < 0, 0, IIF(tnNewVal > 100, 100, tnNewVal))
.lblPercent.Caption = LTRIM(str(tnNewVal) + '%')
.shpodometer.Width = (3 * tnNewVal)
*** Check Title
IF TYPE( "tcText" ) = "C" AND ! EMPTY( tcText )
.lblTitle.Caption = tcText
ENDIF
ENDWITH
thisform.LockScreen = .F.
ENDPROC
ENDDEFINE
*
*-- EndDefine: xcntodo
**************************************************