Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data translation Class
Message
De
12/10/1997 19:12:36
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Data translation Class
Divers
Thread ID:
00054250
Message ID:
00054250
Vues:
73
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.

Equally well the data could be US dollars, and the user input is in Japanese yen, or perhaps the data in degrees celcius and the user view is degrees fahrenheit. In any case, its not the conversion functions that are giving me problems but how to build the class.

Lets try the TimeOfDay sample problem. I have created a container (cnt) that holds 2 textboxes (txtSeconds and txtUserDisplay) and has two methods (SecondsToText() and TextToSeconds()) attached to it. The textbox TxtSeconds would have visible = .f. in the working version.

My approach has been to set the controlsource for txtSeconds as MyTable.TimeOfDay and the controlsource of txtUserDisplay as this.parent.SecondsToText(this.parent.txtSeconds.value). Unfortunately VFP complains that SecondsToText is not an array. I agree with this, but cannot seem to resolve it. "DECLARE PROCEDURE SecondsToText" doesn’t seem to help.

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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform