Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LABEL color class
Message
 
To
02/11/2004 09:46:43
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00951785
Message ID:
00957014
Views:
13
>No addition, no nothing. Just that.
>Can you get the code of ColorLabel class from Class Browser, and show it here ? Maybe you missed something

ok, here it is:

**************************************************
*-- 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
**************************************************
"Build a man a fire, and he's warm for a day.
Set a man on fire, and he's warm for the rest of his life."
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform