Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need function to find Monday by Week No
Message
 
 
À
25/09/2005 18:54:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01052733
Message ID:
01053068
Vues:
20
Peter,

Another very cool, very useful and practical suggestion. Thank you very much! And thank you for the code too. I will try it.

>
>Why not use ToolTipText?!
>
>In the label's init() you can easily create its tooltiptext.
>
>I also advice you to make a class of the label with a property nWeek. And use that property in the label's init() to create the caption and the tooltiptext. Then, all you have to do is drop that class 52 times on the form, or write a simple piece of code in the form's init() that uses addobject() and xy-coordinates to create the objects.
>
>Oh well, here's the code...
>
>
PUBLIC oform1
>
>oform1=NEWOBJECT("form1")
>oform1.Show
>RETURN
>
>*-- Form:         form1 (someform.scx)
>*-- ParentClass:  form
>*-- BaseClass:    form
>*-- Time Stamp:   09/26/05 01:33:11 AM
>*
>DEFINE CLASS form1 AS form
>
>	Top = 0
>	Left = 0
>	Height = 286
>	Width = 761
>	DoCreate = .T.
>	Caption = "Form1"
>	Name = "Form1"
>
>	PROCEDURE Init
>		local lnX, lnY, lnW, lcW
>
>*		set classlib to someclasslib.vcx
>
>		for lnW = 1 to 52
>			lnX = ( mod( m.lnW - 1, 13 ) ) * 50 + 50
>			lnY = ceil( lnW / 13 ) * 20
>			lcW = 'lblWeek' + padl( m.lnW, 2, '0' )
>			this.addobject( m.lcW, 'weekno', 2005, lnW )
>			with this.&lcW
>				.left   = m.lnX
>				.top    = m.lnY
>				.visible = .T.
>			endwith
>		next
>
>		this.showtips = .t.
>	ENDPROC
>ENDDEFINE
>
>*-- Class:        weekno (someclasslib.vcx)
>*-- ParentClass:  label
>*-- BaseClass:    label
>*-- Time Stamp:   09/26/05 01:19:07 AM
>*
>DEFINE CLASS weekno AS label
>
>	Caption = "Label1"
>	Height = 17
>	Width = 40
>	Name = "weekno"
>	nWeek = .F.
>	nYear = .F.
>
>	PROCEDURE Init
>		lparameter tnYear, tnWeek
>
>		with this
>			.nYear       = m.tnYear
>			.nWeek       = m.tnWeek
>			.caption     = str( .nWeek, 2 )
>			.tooltiptext = dtoc( DATE(.nYear,1,1)-DOW(DATE(.nYear,1,1),3) + .nWeek*7 )
>		endwith
>	ENDPROC
>ENDDEFINE
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform