Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data translation Class
Message
 
À
12/10/1997 19:12:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00054250
Message ID:
00054264
Vues:
27
>I'm trying to build a class that displays data differently to the user than the format its held in, in the underlying data. In my case the class sits between the TimeOfDay field that holds seconds since midnight, and the form’s textbox that shows (and accepts) values in a "hh:mm" format.
>
>Short term problem: resolve the not an array issue. The bigger problem: what is the best way to go about setting up a translation class like I have described. I'm not convinced that I'm taking the right approach.
>
>Bob


There is one of the way to do what you try to do,
This sample is use to translate some colors from english to french
and from french to english (of course).

In this class, i assume that you call a 'thisform.refresh()' on
the skip or any navigation you do on the underlaying table.
**************************************************
*-- Class:        converter 
*-- ParentClass:  textbox
*-- BaseClass:    textbox
*
DEFINE CLASS converter AS textbox


	Height = 24
	Width = 265
	Name = "converter"
	realsource = 'dummy.color'


	PROCEDURE convertfrom
		xSource = (This.RealSource)
		do case
			case &xSource = 'Green'
				this.value = 'Vert'
			case &xSource = 'Blue'
				this.value = 'Bleu'
			case &xSource = 'Yellow'
				this.value = 'Jaune'
			case &xSource = 'White'
				this.value = 'Blanc'
		EndCase

	ENDPROC


	PROCEDURE convertto
		xSource = This.RealSource
		do case
			case this.value = 'Vert'
				Replace &xSource with 'Green'
			case this.value = 'Bleu'
				replace &xSource with 'Blue'
			case this.value = 'Jaune'
				replace &xSource with 'Yellow'
			case this.value = 'Blanc'
				replace &xSource with 'White'
		EndCase

	ENDPROC


	PROCEDURE Refresh
		this.convertfrom()
	ENDPROC


	PROCEDURE Valid
		this.convertto()
	ENDPROC


ENDDEFINE
*
*-- EndDefine: converter
**************************************************
I hope this help.

;0)
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...


Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform