Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The Grid Control's Delete Mark In FoxPro 9 doesn't work. 1

Status
Not open for further replies.

mjk9564

Programmer
Apr 23, 2003
64
US
We are trying to upgrade to FoxPro 9 Service Pack 1 from FoxPro 8 and we have noticed that the delete mark on our grids can no longer be clicked. We have several grid controls that are bound to a cursor and the users can delete the records by clicking the delete mark on the grid. Now when the user clicks on the delete mark nothing happens. Is there another property or something that we need to set in order for this work in FoxPro 9. I have looked at some of the literature and from what I found Microsoft is saying nothing has changed.

NOTE: All the cursors are set to ReadWrite.
 

I can assure you that the delete mark does work in VFP 9.0, just as it does in all earlier versions.

Something must be different in your new environment. You say the grid is ReadWrite. Is it possible that its AllowCellSelection property is .F.? Or that the entire table is read-only?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
It was the AllowCellSelection Property. This has changed in FoxPro 6-8 you could set this to false and still use the Delete Mark. I will use the read only property instead now.

Thank you for your help!

 
This has changed in FoxPro 6-8 you could set this to false and still use the Delete Mark. I will use the read only property instead now.

You are mistaken here. AllowCellSelection was introduced into the language in version 8 and it behaved the same way in version 8 as it does in version 9.


Marcia G. Akins
 
No you are mistaken here. Read the Visual FoxPro Language Reference for VFP 8 and then for VFP 9. Don't take my word for try it yourself I know you'll see you are mistaken on this. We have been using VFP 8 for over a year now with this set on all our grids to avoid the color change in the selected cell. I'll post the main points here for you.

Visual FoxPro Language Reference for 8 (Second to last bullet)

"Support for Find is disabled as well as Edit menu commands because setting AllowCellSelection makes the grid read-only. However, the AllowCellSelection property does not affect the delete mark column in a grid."

Visual FoxPro 9.0 Language Reference (Fourth Bullet)

"You cannot select a row in the grid for deletion by clicking the deletion column as this functionality is disabled."

Now what is interesting here is that the second to last bullet is still in the VFP 9 Language Reference, but this is obviously a mistake, because the fourth bullet specifically says it does affect the delete mark.

On another note I would like to say how impressed I am with this site. I posted the same exact post on Experts Exchange more than 2 hours before this post and didn't get any replies even after setting the highest point value available. I posted it on this site and in less than 1 hour I had the answer. Go Tek-Tips!
 
Just to follow up that last point, this is from the "Changes in Functionality for the Current Release" page in the 9.0 Help:

AllowCellSelection Does Not Permit Deleting Grid Rows When Set to False

When the AllowCellSelection Property is set to False (.F.) for a Grid control, you cannot select a row for deletion by clicking the deletion column. For more information, see AllowCellSelection Property.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
I agree I have looked in VFP 6 to see if it had that property and it doesn't. Boy does time fly I thought we had been using it since VFP 6, but obviously we didn't implement it until VFP 8.

Thanks again for the help Mike!

Matt Kenney
 
Hello MJK9564.

"Support for Find is disabled as well as Edit menu commands because setting AllowCellSelection makes the grid read-only. However, the AllowCellSelection property does not affect the delete mark column in a grid."

Visual FoxPro 9.0 Language Reference (Fourth Bullet)

"You cannot select a row in the grid for deletion by clicking the deletion column as this functionality is disabled."

I stand corrected. Thanks for the information - I learned something new today :)

FWIW, I have never allowed users to delete records from my data entry grids using the delete mark becuase it all gets too difficult to manage. The reason that I say this is (as I am sure you already realize since you say that you use this technique quite often) explained in this excerpt from chapter 6 of "1001 Things You Wanted to Know about VFP":

Before taking action, we must verify we are positioned on the record to be deleted. It is possible to click on the delete mark in any row of the grid. The record pointer in the grid's RecordSource does not move until the Deleted method has completed. This means that, at this point in time, it's possible that nRecNo, the parameter passed to the Deleted method, is not the same as the RECNO() of the current record. However, moving the record pointer unconditionally to nRecNo causes the grid's AfterRowColChange to fire. Setting focus to the grid afterward to refresh it causes the grid's Valid to fire. Both these events cause the row level validation to take place. If the user is trying to delete a record that he just mistakenly added, we don't want this validation to occur. We just want to revert the record. And just to make things interesting, the record number of the newly appended record is a negative number while nRecNo is positive:

Marcia G. Akins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top