CALC.VCX
*
*   Author:       Gene Steinbacher
*                 (c) United Consulting, Inc.,  1995
*  Contact:       (913) 441-8514
*                 (816) 221-9300
*                 73214,1547              Compuserve
*
************************************************************************
Introduction:
	Calc.vcx is a group of classes to process calculating numeric values.  These classes include a calculator class, a textbox class which you can do simple calculation within, an improved Foxpro calculator, a Popup calculator, and a combination textbox and popup calculator container.  Each is described in more detail below.


______________________________________________________________________________

CalcFoxpro:		
	This class is an improved FoxPro calculator.  It uses all the same hotkeys and everything.  It also uses the _CALCVALUE and _CALCMEM system variables.  The real difference between this calculator and the Foxpro one is that this one is an object.  Which means you can create multiple instances of it, you can reference it within a program, and you can read and modify properties of it.  In other words, you have more control over it.  It is not modal so the user can display the calculator and leave it running while doing other processing.  This class is good for doing generic calculations that do not need to be stored to a specific value.

	You can even release the variable used to create the object and the calculator will still be displayed.  It is a simple technique but still pretty handy.  The CalcFoxpro has a property (r_oSelf) which is set to its own object reference in the "Init" Method ("This.r_oSelf = This").  Since you cannot release the property, the form remains displayed until the user closes it.
		Eg.  SET CLASSLIB TO <calc_classlib>
				 loCalc = CREATEOBJECT("CalcFoxpro")
				 loCalc.show
				 RELEASE loCalc				&& The calculator is still displayed.
				 
		NOTE: It CAN Be released with the statement: "loCalc.release".
				 
______________________________________________________________________________


CalcPopup:		
	This class is very similar to the CalcFoxpro calculator.  The main differences are that you can pass parameters when you call it and you can return a value back to the calling program.  It does not use the _CALCVALUE and _CALCMEM system variables.  It also returns to the calling program when the Equal (=) or ESC is pressed.  It is MODAL so the user must finish using it before moving to another process.  This class is good for doing calculations that need to be stored in a specific value.
	
	Parameters
		1)	Value to be displayed in the calculator when first displayed.
		2)	Position of the top of the calculator (default is zero).
		3)	Position of the left hand side of the calculator (default is zero).
		
	Properties:
		nCalcVal:	The property which holds the value for the calling program.
							If ESC is pressed, this value is set to .NULL.
			
	Eg.     LOCAL loCalculator
					SET CLASSLIB TO <calc_classlib>
					loCalculator = CREATEOBJECT("CalcPopup", This.value)
					loCalculator.show
					IF NOT ISNULL(loCalculator.nCalcVal)
						This.value = loCalculator.nCalcVal
					ENDIF
					RELEASE CLASSLIB <calc_classlib>
______________________________________________________________________________

		
CalcContainer:
	This class is the actual calculator used in CalcFoxpro and CalcPopup.  It must be placed on another object before an instance of it can be created.  But it is a completely self contained calculator.  In other words, you can place this calculator on any form and it will work.

	Properties:
		r_lFoxPro:	Do you want to use the Foxpro calculator system variables
								(_CALCVALUE and _CALCMEM). True (.T.) means use them.
	
	NOTE: For the hotkeys to work you must place the following line in the
				KeyPress Event of the form or formset:
		 			<object>.<classname>.m_keypress(nKeyCode, nShiftAltCtrl)
		 				
		 		Eg. Thisform.cntCalc.m_keypress (nKeyCode, nShiftAltCtrl)
		 				(Notice the two parameters are the actual parameters 
		 				 passed to the KeyPress Event).
______________________________________________________________________________

CalcTextBox:
	This class is a textbox control which allows the user to do simple math calculations (add, subtract, multiply, divide) within the textbox itself.  The only other key available (besides the digits) is 'C', which resets the calculated value to zero.

_____________________________________________________________________________

CalcCombo:
	This class is a combination of the CalcTextBox and CalcPopup classes.  You can do the calculations within the CalcTextBox control or you can click on a command button to display the CalcPopup.  On return from  the CalcPopup, the calculated value is stored in the CalcTextBox control.  One nice feature worth mentioning is that the command button is not visible unless the cursor is in the CalcTextBox control.  This makes the form look much nicer to the user when there are several of these classes on the form.

______________________________________________________________________________
______________________________________________________________________________

DEMO:
	To run the demo simply type DO DEMO.  A form is displayed which has examples of all four	classes on it.

______________________________________________________________________________


Comments by Gene:

- The project file is there to give you easy access to the source code.  You do not need it to run the demo.

- Any comments or suggestions would be appreciated.  
	Complaints and worthless rhetoric will be read; but probably not appreciated.

- I love this object oriented stuff.

- I am not going to put all the legal mumbo-jumbo about "all rights reserved" and "not responsible" in this document.  I would think by now that everyone is aware of this fact about freeware.  "All Rights" are reserved, and "I AM NOT RESPONSIBLE" for anything that happens because you chose, WITH YOUR OWN FREE WILL, to use this software.

	Gene Steinbacher
	United Consulting, Inc.
	911 Main Street
	Kansas City, Mo. 64105
	(816) 221-9300
	
	Compuserve ID:  73214,1547
	
	





