Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Class for transforming paires into dozens & vice versa
Message
 
 
To
21/10/1998 15:02:28
Pierre Sauve
Micro-Fox Canada Inc.
Montréal, Quebec, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00149030
Message ID:
00149142
Views:
14
Pierre,

You can also use a single textbox if you unbind it from the real datasource and put code in it's Refresh() and Valid methods(). I created a class that displays and lets users edit in inches and fractional inches but the data is stored numeric.
Refresh()
bTextBox::Refresh()

this.Value = InchToString( evaluate( (this.mcControlSource) ) )

<b>Valid()</b>
local lnInches, lnFrac, lcInches, lcFrac, i

this.Value  = alltrim( this.Value )
i = at( ' ', this.Value )
if ( i > 0 )
   lcInches = left( this.Value, i - 1 )
   lnInches = val( lcInches )
   lcFrac = chrtran( substr( this.Value, i ), " ", "" )
   lnFrac = evaluate( lcFrac )
else
   lnInches = val( this.Value )
   lnFrac = 0
endif

replace (this.mcControlSource) with lnInches + lnFrac

<b>Init()</b>
bTextBox::Init()

* we have to unbind this

this.mcControlSource = this.ControlSource
this.ControlSource = ""

this.Refresh()

<b>Keypress()</b>
LPARAMETERS nKeyCode, nShiftAltCtrl

do case
   case ( ( nKeyCode > 57 ) and ( nKeyCode < 127 ) )
      nodefault
   otherwise
      bTextBox::KeyPress( nKeyCode, nShiftAltCtrl )
endcase
>This is the easy part . My real big problem is when I create the screens . The field somehow need to show like two fields . On where the dozens part will show and one where the pairs part will be with a little label in the middle for the dot. I suppose too that I will need two variable ( properties) to hold this data. I that write ?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform