Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LABEL color class
Message
From
02/11/2004 10:56:13
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00951785
Message ID:
00957047
Views:
15
>>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
>**************************************************
On the beginning of your "Caption_Assign" method, you have this code.
	PROCEDURE caption_assign
		LPARAMETERS vNewVal
		*To do: Modify this routine for the Assign method
		THIS.caption = m.vNewVal
That code is generated from the default VFP. Remove the "THIS.caption = m.vNewVal"
Herman
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform