Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data translation Class
Message
From
13/10/1997 03:11:00
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00054250
Message ID:
00054273
Views:
22
>>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)

////////////////////////////////////////////////////


Merci Gérald

Your solution is elegant, and it works!

Thanks so much. You’ve broken me out of a circle that I have been running in for more hours than I wish to admit.

Bob in Calgary
Previous
Reply
Map
View

Click here to load this message in the networking platform