5

The LA Fox Developer Newsletter
April 1997
The previous diagram illustrates the classes of an employee business object that utilizes polymorphism. Utilizing this format, an entire payroll can be accomplished with very few lines of code as shown in the following example:

Example Employee Business Object using VFP:

SET CLASSLIB TO ‘mynew.vcx’
oEmployee = CREATEOBJECT(’employee’

ocompanyState = CREATEOBJECT(oEmployee.State) USE employee

SCAN
oEmp = CREATEOBJECT(ALLTRIM(employee.title))
=oEmployee.CalcPay(oEmp,oCompanyState)

RELEASE oEmp
ENDSCAN
USE
RELEASE oCompanyState
RELEASE oState
RELEASE oEmpioyee

The main class, Employee, defines the four methods, CalcPay, CalcGross, CalcFed, CalcState.

CalcPay is the main method that calls the other three methods before returning the final payroll figures. It receives as a parameter, an instance of the employee type object, either Hourly, Salary, or Commission and the specific state object for the company.

The CalcGross methods exist in the subclasses of Employee, Hourly, Salary, and Commission where specific methods for calculating GrossPay are located. It is this method that returns the GrossPay back to the Employee.CalcPay method.

The CalcFed is located in the Employee object since all employees calculate federal tax the same way. It returns the FederalTax back to the CalcPay method of the Employee class.

For one client, the code for CalcState could be in the Employee object. This however limits the reusability of the Employee object. Instead, by creating a State class, with the calculations for that state payroll tax as a method, new states can be added by merely creating additional objects. These objects, would then pass the calculated state tax back to the Employee.CalcPay method.

(Con’t, page 8)
Hot Tip
How to Change the
Mouse Cursor
by Arnon Gal-Oz
Virtual FoxPro User Group

This tip shows u how to change the mouse cursor to any cursor shape you desire.

**
these are the WIN32API functions u need for changinf the
**
mouse cursor
declare integer LoadCursorFromFile in win32api as NewCur string declare short SetSystemCursor in win32api Integer ,integer

*NORMAL
32512 - usually u would put these in a .h file
*IBEAM
32513
*WAIT
32514
*CROSS
32515
*UP
32516
*SIZE
32640
*ICON
32641
*SIZENWSE
32642
*SIZENESW
32643
*SIZEWE
32644
*SIZENS
32645
*SIZEALL
32646
*ICOCUR
32647
*NO
32648 (Win NT only)
* get a handle for a new cursor nCurHndl=NewCur(”c:~vfp\samples\graphics~cursors~down.cur”)
*
this example changes the norami (arrow) cursor to the new
cursor
*
u can use normal0l.cur to return to the normal cursor
nchangOK=SetSystemCursor(nCurHndl,3251 2)

*after u changed one of the “system” cursors to ur own
*u can use the MousePointer property to reference it


[Ed. Note: Arnon Gal-Oz is the Head of Computer Dept. of On Time Serial Supply, an Israeli subscription seivices company. He is also the President of the Israeli foxpro User Group, and the Tehcnical Manager of the Virtual Foxpro User Group. If you’re interested in joining this “virtual” group, you may do so by visiting The Visual FoxPro Yellow Pages, at http:I/ www.transformation.com and filling out the membership application. And best of all? It’s free!!]
Spring Conference
Vendors Announced
As you may know, we’ve added a fifth track to the conference which will be reserved for vendors presenting their products, as well as a Vendor Trade Show. Among vendors participating in the sessions and trade show will be Micromega (Foxfire!), Kevin McNeish (“Framework for Mere Mortals”P’Codebook for Mere Mortals”), Roger Woodsmall (AutoManual), Doug Hennig (Stonefield Data Dictionary), Drew Speedie/MaxTech (Visual MaxFrame Professional), and xCase.
Business Objects (Con’t from page 3)
Page 5

5