Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a Cursor
Message
From
10/03/2005 16:19:41
Todd Cottengim
Alpine Land Information Services
Redding, California, United States
 
 
To
10/03/2005 15:49:02
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00994604
Message ID:
00994634
Views:
28
>I would like the total column to be only visual. Note that there can be multiple entries under each day that have different job numbers so the total has to be for each row.

I did a "quick and ugly" test and came up with the following. It might get your creative jucies flowing.

This will allow you to enter values into the first two columns, but the third column (Total) is read only. I'll leave it to you to handle captions and formats
** cursor for holding hours
** note, the third column "nTotal" is just a bogus column but needs to be there
CREATE CURSOR cHours (nRegular i, nOvertime i, nTotal i)
** adding some test data
INSERT INTO cHours VALUES (8,0,0)
INSERT INTO cHours VALUES (8,2,0)
INSERT INTO cHours VALUES (8,5,0)
INSERT INTO cHours VALUES (8,1,0)
INSERT INTO cHours VALUES (8,0,0)
INSERT INTO cHours VALUES (8,3,0)

** go to the top record
LOCATE

** Create the form with a grid
PUBLIC loForm
loForm = NEWOBJECT("form")
loForm.Width = 400
loForm.Height = 400

WITH loForm
	** add the grid
	.AddObject("grdTimeSheet", "grid")

	WITH .grdTimeSheet
		** format the grid
		.Visible = .T.
		.Top = 5
		.Left = 5
		.Width = 390
		.Height = 390
		
		** set record source
		.RecordSource = "cHours"

		** force column 3 to display the sum of columns 1 and 2		
		.Column3.ControlSource = "nRegular + nOvertime"
	ENDWITH
ENDWITH

** show the form
loForm.Show
Previous
Reply
Map
View

Click here to load this message in the networking platform