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

Keep highlighted row in place on a grid

Status
Not open for further replies.

wtotten

IS-IT--Management
Apr 10, 2002
181
US
Hi,

I have looked here, and Google-ed this, and I can't find a solution, so I'll post this here and hope someone has an answer.

The pointer is on a row in the grid - say it's the fifth row in the grid. I have to rebuild the grid which includes changing its RecordSource - it stays the same - I'm not using a different data source, but the RecordSource property is reset by the grid "rebuild" code (I call the Grid.Init() and some other methods). The main reason I rebuild the grid is because I change the number of columns (note that setting Column[x].Visible isn't applicable for this app).

Once I do the rebuild of the grid I want the pointer to stay on the same record (not a problem - I can make that work) and I want the highlighted row to still be the fifth row in the grid (that's my problem).

Any ideas?

Thanks,
Bill
 
would going to that that record and refreshing the grid work?


HighlightRow = .t.
HighlightStyle = 2

I have one of my grids like that and i do the same thing.

before i rebuild it, i have an IID form the table, and when get the cursor.. i locate the IID and i refresh my grid.


Ali Koumaiha
TeknoSoft Inc.
Michigan
 
That doesn't work. It does keep the pointer on the right record, but the grid scrolls on me.
 
You have to use DoScroll and get ActiveRow to the same value as it was before.

Bye, Olaf.
 
Hi Bill,

Perhaps you can use the RelativeRow property to find the current row number. Save that to a variable before rebuilding the grid. Then, after you have rebuilt, use DoScroll to move the back to the saved row number.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top