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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert, Delete in Grid

Status
Not open for further replies.

alisaif

ISP
Apr 6, 2013
418
AE
Hi,

Is it possible to Append and Delete in a Grid by using menu which contains three options: 1. Insert 2. Delete. 3.Cancel and should by popup by right click event on grid.

Thanks

Saif
 
Yes, this is possible.

However, you don't insert or delete directly to the grid. You have to add or remove records in the underlying table or cursor. You can do that using normal table commands, such as APPEND, INSERT, DELETE, etc. After you have updated the table in that way, just set focus to the grid to make the changes visible (you don't need to refresh the grid).

As for putting it in a menu, that's also possible. Just create your menu in the normal way, and have it execute the above commands.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
That fails in one simple aspect: As the grid is just the container of columns and rows each click/rightclick etc event go to the single controls inside it. You can and have to bind each rightclick to a handler event (which could be grid.rightclick) via BINDEVENT and then that could create and show the context menu.

You could add a column with a delete button to delete a row, a cancel button to cancel changes (which needs buffering in general and tablerevert in the moment of cancelling) and you could add an add button, that would be easierr to achieve, also the grid has AllowAddNew, which means you simply create new rows by arrow-down key while being in the last row the grid displays.

Not so intuitive but possible is showing the DeleteMark of the grid, which does allow a user to click there to delete a row.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top