RecordMark, DeleteMark
These two properties
determine whether a grid has the two special columns at the left
that contain a little record pointer and indicate deleted
records, respectively.
Usage
|
grdGrid.RecordMark = lHasRecordMark
lHasRecordMark = grdGrid.RecordMark
grdGrid.DeleteMark = lHasDeleteMark
lHasDeleteMark = grdGrid.DeleteMark
|
Although we've shown both of these as needing logical
values, you can actually specify 0 or 1 (for .F. and .T.,
respectively) as well. We can't figure why this is, since
generally you can't use numerics for logicals in FoxPro. Guess
some C guy got carried away.If you set both of these to .F. (or
zero), the left-hand border of the grid is pretty wimpy looking.
So, even if you don't want delete markers (and you probably
don't), you may want the RecordMark column. A grid with
RecordMark = .T. and DeleteMark = .F. looks pretty nifty. The
DeleteMark is pretty lame—it blacks out an entire box. We'd
prefer an "X" or skull-and-crossbones, or even better, a column
where we can put in our own controls and method calls—come to
think of it, we can do that! And we think you should.So why don't
you want delete markers? When DeleteMark is .T., the user can
delete a record by clicking on the delete mark for that row. At
that point, triggers fire, the record needs to be locked and so
forth. We don't think we'll be writing many applications in which
deletion should be as easy as clicking in a grid. Generally,
deletion is a pretty serious operation and you should control it
in your app. We've also heard some stories about locking issues
and the like when users delete records from parent-child grids or
try to use a single click to both select and delete a record.
Although we haven't been able to replicate these ourselves, we've
heard enough of them to believe that allowing deletion in grids
requires kid gloves.A DeleteMarkReadOnly property to let our
users look but not touch has been suggested by others, but we'd
suggest you drop the DeleteMark altogether and add in a read-only
check box.
Example
|
* Add a record mark to an existing grid
ThisForm.grdMyGrid.RecordMark = .T.
|
Back to Table of Contents
Copyright © 2002-2018 by Tamar E. Granor,
Ted Roche, Doug Hennig, and Della Martin. Click for license
.