Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Input text in value field?
Message
 
 
À
14/09/1998 12:43:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00136261
Message ID:
00136322
Vues:
17
David,

I have an app doing a very similar thing. My txtInches class "unbinds" itself in the Init and stores the ControlSource to a custom property mcControlSource that is used in the Valid() and Refresh(). It has code in the Refresh() to convert from decimal inches stored in the table to fractions (numeric 24.75 -> character 24 3/4). The Valid() method converts back to a number and does a REPLACE to the field.

Doing it this way there's no need to have a second object. And your calculations can all just be based on the raw table field value.

>My 'Reduction of Area' app uses inches for all calculations. I want my users to be able to type in a metric number and VFP to store the inch conversion. This is the Interactive change event of a Value field.
>
>(I did not remember how to program, AddObject Text1, so I have the object placed visually through the form designer.)
>(Make Text1 appear over the Value field)
>
>ThisFormset.REDAREA.Text1.Enabled = .T.
>ThisFormset.REDAREA.Text1.Visible = .T.
>ThisFormset.REDAREA.Text1.Value = ThisFormSet.Remove0(This.Value,5,1) &&5 integers, 1 decimal
>ThisFormset.REDAREA.Text1.Top = This.Top
>ThisFormset.REDAREA.Text1.LEFT = This.Left
>ThisFormset.REDAREA.Text1.Width = This.Width
>ThisFormset.REDAREA.Text1.SelStart= this.SelStart
>ThisFormset.REDAREA.Text1.SetFocus()
>
>(Text1 will allow input like 13.6mm, 5m*12pc or even 13' for RED_MATH to convert and calculate inchs)
>(How do I wait for Text1 to lose focus before I retreive the Value?)
>
>This.Value = ThisFormSet.RED_MATH(ThisFormset.REDAREA.Text1.Value)
>ThisFormset.REDAREA.Text1.Enabled = .F.
>ThisFormset.REDAREA.Text1.Visible = .F.
>
>PS I have the the Metric conversion routine in RED_MATH.
>Or how do I have Text1 Send back the Value to this same object?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform