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

Dual grid update problem when changing indexes

Status
Not open for further replies.

dbMark

Programmer
Apr 10, 2003
1,515
US
Ok, grids are not behaving as I would expect.

Grid1 (2 columns)
Group Code ... Group Name

Grid2 (3 columns)
Group Code ... Individual Code ... Individual Name

The 2 tables do not use SET RELATION. I tried that at first but only one row would show in Grid1, so I removed it.

I allow the user to select a different index for each of the 3 lower columns, all they have to do is click the column header. That code to change the index is in the Column's header Click code. The code to sync Grid1 to changes in grid2 is in the grid's AfterRowColChange method.

It works fine for the 2 leftmost columns, Group Code and Individual Code. But the problem arises when a user clicks on the Individual Name column. The index is set and the grid2 refresh is called as happens on all 3 columns' code, but somewhere between that call to grid.Refresh and AfterRowColChange opens, the table record pointer changes to one at the top of the grid2 and I don't know why. There's even two arrows on the grid while inside AfterRowColChange.

I guess I'll have to debug some more. Let me know if I'm using the wrong events or methods to do what I'm trying to do...
 
If you don't do set relation, the two tables will be independant on each other, so it's unclear what causes that behaviour. What code do you have in the AfterRowColChange. You might wanted to use the BeforeRowColChange, if you want to update grid1 witht the changes in the active row of grid2, AfterRowColChange will occur, after you changed the row in grid1, that is when you are not on the source record any more.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top