>>************************************************** >>*-- Class: colorlabel (d:\apps\csu\clslabel.vcx) >>*-- ParentClass: container >>*-- BaseClass: container >>*-- Time Stamp: 11/02/04 09:38:12 AM >>*-- Make a colorful label >>* >>DEFINE CLASS colorlabel AS container >> >> >> Width = 55 >> Height = 24 >> BackStyle = 0 >> *-- Caption for label >> caption = "RED SOX" >> *-- Name of the Font. Blank/Empty = use the default FontName from FORM >> fontname = "" >> Name = "colorlabel" >> >> *-- Size of the Font. .F. = use the default FontSize from FORM >> fontsize = .F. >> >> *-- Specifies if the text is bold. >> fontbold = .F. >> >> >> PROCEDURE setcaption >> Local ln_X, lc_Object, ln_Left >> >> With This >> .BorderWidth = 0 >> If empty( .FontName ) >> .FontName = ThisForm.FontName >> endif >> >> If empty( .FontSize ) >> .FontSize = ThisForm.FontSize >> endif >> >> ln_left = 1 >> >> For ln_X = 1 to len( .Caption ) >> lc_Object = 'lblName' + alltrim(str( ln_X )) >> >> .NewObject( lc_Object, 'lblChar', 'ClsLabel', , ; >> substr(.Caption, ln_X, 1), .FontName, .FontSize, .FontBold ) >> >> With .&lc_Object >> .Top = 1 >> .Left = ln_Left >> .Visible = .T. >> ln_Left = ln_Left + .Width - 2 >> EndWith >> Next >> >> .Width = ln_Left + 2 >> .Height = .&lc_Object..Height + 1 >> EndWith >> ENDPROC >> >> >> PROCEDURE caption_assign >> LPARAMETERS vNewVal >> *To do: Modify this routine for the Assign method >> THIS.caption = m.vNewVal >> >> >> Local ln_X >> >> With This >> If !(.Caption == vNewVal) >> For ln_X = 1 to This.ControlCount >> lc_Object = 'lblName' + alltrim(str( ln_X )) >> .RemoveObject( lc_Object ) >> Next >> >> .Caption = vNewVal >> .SetCaption() >> endif >> EndWith >> ENDPROC >> >> >> PROCEDURE Init >> this.setcaption() >> ENDPROC >> >> >>ENDDEFINE >>* >>*-- EndDefine: colorlabel >>************************************************** >>
> PROCEDURE caption_assign > LPARAMETERS vNewVal > *To do: Modify this routine for the Assign method > THIS.caption = m.vNewVal >>