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

Strange insert/delete Grid behaviour VFP60

Status
Not open for further replies.

andre65

Programmer
Jan 19, 2003
95
NL
I have a form with 3 grids where the table relations are set in the DataEnvironment.
The rows in each Grids are displayed fine.

Insert question:
When inserting/appending a row in the parent (by doing APPEND BLANK) the rowfocus moves to the last line of the Grid (at my empty line position). That is exactly what I want.
Now when doing this in the two detail Grids, the rowfocus always moves to the first line, so I have to click/scroll to the new inserted record.
I tried removing the relationships in the dataEnvironment and put in the form.init metod code SET FILTER TO for setting the relationship. Then the insertion works correct, but then I'm having display problems with the third grid (detail-detail) which is not refreshed correctly when moving through the first (parent) and the second (child) Grid.
How can I solve this.

Delete question:
When I delete all rows in a Grid line by line, finally no rows are displayed in the Grid. When inserting the first record again, the row is not displayed in the Grid. thisform.refresh() does not show me the record.
What else do I have to do to display the record?

Thanks in advance for any help.

André
 
André,

.... the row is not displayed in the Grid. thisform.refresh() does not show me the record.
What else do I have to do to display the record?


As well as refreshing the grid, you have to re-set focus to it. Usually, just doing THISFORM.Grid1.SetFocus is all that's necessary.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Mike,

The Grid already has the focus.
When clicking the mouse into another control and back, then the record is displayed.
 
OK, I solved my delete question:
In grid.afterRowColChange I do
- thisform.lockScreen = .t.
- thisform.otherControl.setFocus()
- this.setFocus()
- thisform.lockScreen = .f.

Now the one left is my insert question.
Any suggestions?

Gr,
André
 
André,

When clicking the mouse into another control and back, then the record is displayed

But that's exactly what I was saying. Except that you can also do it programmatically using SetFocus.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top