![]() |
![]() |
6 |
![]() |
The LA Fox Developer Newsletter
|
December 199T
|
Visual
Time &
Effort
(Con’t
from page
5)
linked them via the position number field.
gave them labels.
it”grdEffort”; the COLUMNCOUNT property is 2, RECORDSOURCE property of the grid is TIMEEFFI, the RECORDSOURCETYPE property is 1-Alias, and the VIEW property is 0 BROWSE BROWSE.
See illustration to see what my form looks like.
II. Control Buttons
Icon on the Toolbar, I “Added”
d:\vfox\samples\controls\buttons.vcx.
This gave me some sample foxpro button objects to add to my form. I chose the vcr icon and placing this sample on form “Time & Effort” gave me the Top, Bottom, Previous and Next buttons with no coding on my part.
and Done. To the Click code of these buttons I added normal code. As an example for the Browse button I added code to display the parent table but not allow users to modify this data:
browse nomodify
thisform.refresh()
the Click methods of these two buttons I added the following code:
Add Code:
select timeeffi append blank replace posnumb with position.posnum thisform.grdEffort.fundorg.txtfundorg.set thlsform.grdEffort.Refresh()
Delete code:
select timeeffi delete next I
I added a TEXTBOX on the parent form named nTotalPercent and gave it a label as well.
added a NEW PROPERTY: PercentTotal.
|
calcpercent
property is calcpercent. Double clicking on this method brought up the click code for calcPercent and here I added the following code:
para positlonumber
SELE timeeffi
IF SEEK(positionumber)
SUM pctfund for posltionumber=posnumb;
TO nPercent
ELSE
nPercent
=
0
ENDIF
SELE position
RETURN npercent
needed to run this method whenever
a) you started the project
b) a new employee (parent) record was displayed c) an addition, change, or deletion was made in the grid percents
the INIT property when starting the project, REFRESH property for a new record and the change.
INIT Code of Form
CLOS ALL
CLEAR
THISFORMSET.NPERCENTTOTALthi5f0rm5et.calcpercents(posnum)
REFRESH Code of Form
THlSFORMSET.NPERcENuoTAL=thisformseLcaIcpercents(p~num)
AfterRowColChange Code of Grid:
LPARAMETERS nCollndex m rec
=
rec n 00 mposnumbposnumb
SUM pctfund for mposnumb=posnumb TO thlsform.PercentTotal
go mrec
thisform.nTotalPercent.Refresh()
field did contain a running total of my percent field from the child table.
(Ed. Note: Mike Merino works for Denver Public Health. He can be reached at MMerino@dhha.org. The Time & Effort project is his second Visual Foxpro program. He and his wife Jonna are enjoying their new 9 month old daughter Molile, whose keyboard technique is still rather random.]
|
Page 6
|
![]() |
![]() |
6 |
![]() |