Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating a Cursor
Message
De
10/03/2005 16:19:41
Todd Cottengim
Alpine Land Information Services
Redding, Californie, États-Unis
 
 
À
10/03/2005 15:49:02
Steven Dyke
Safran Seats USA
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00994604
Message ID:
00994634
Vues:
24
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform