General information
Category:
Forms & Form designer
George,
I was searching the UT for a 'simple' thermometer program/class and I came across your solution in message 616923 on 7th Feb. 2002. It could be the solution I am looking for, but I cannot get it to work!
My test code is as follows...
SET PROCEDURE TO Therm1 ADDITIVE && the code below is in Therm1.prg
loTherm = CREATEOBJECT('therm',50,"Thermometer window")
loTherm.visible = .T.
Could you point me in the right direction as to how to deploy the thermometer? I have looked at loTherm in debug window, and the object appears alive and well. If only I could see it!
TIA
Alan Harris-Reid
**************************************************
*-- Class: therm (c:\program files\microsoft visual foxpro 7\ida\classes\therm.vcx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 06/22/98 03:55:10 PM
*-- Thermometer
*
DEFINE CLASS therm AS form
Height = 87
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)
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
**************************************************
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only