Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Invoke a calculator
Message
From
28/11/2003 11:47:23
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
28/11/2003 11:37:18
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00854219
Message ID:
00854236
Views:
28
>>>Hi All:
>>>
>>>Can anyone direct me to information on how to pop up a calculator or some dialog that will allow me to calculate a number to be entered into a text field?
>>>
>>>e.g.
>>>Instead of entering '62987' into a text field, I would somehow like to be able to enter 44234+12542+6211.
>>>
>>>Thanx,
>>>
>>>Yossi
>>
>>Yossi,
>>There are multiple ways.
>>-You could invoke default calculator with 'Activate window calculator' and get calculated value with _CalcValue
>>-Yopu could simply call an inputbox and ask for text. ie:
>>
>>lcCalc = InputBox('Calculate','Enter your expression')
>>* User enters 44234+12542+6211
>>? iif(empty(lcCalc),0,Evaluate(lcCalc))
>>
>>-Create a modal form that would get calculation similar to inputbox etc.
>>Cetin
>Hi Cetin:
>
>I placed the following code into the keypress event of the text box:
>
>
>LPARAMETERS nKeyCode, nShiftAltCtrl
>thisform.txtInKeyValue.value = nKeyCode
>IF nKeyCode = 43  && user pressed the "+"
>	ACTIVATE WINDOW calculator
>	thisform.txtCalcValue.Value = _calcvalue
>ENDIF
>
>
>This doesn't work since the calculator window is not modal and I can't seem to figure out how to make it so.
>
>Thanks,
>
>Yossi
LPARAMETERS nKeyCode, nShiftAltCtrl
IF nKeyCode = 43  && user pressed the "+"
	NoDefault
	_calcvalue = this.Value
	ACTIVATE WINDOW calculator
	DO while Wvisible('Calculator')
	doevents()
	enddo 
	this.Value = _calcvalue
ENDIF
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform