Remembering scroll position in PropertyGrid |
Post Reply |
Author | |
ericchubb
Groupie Joined: 31 May 2010 Location: Ireland Status: Offline Points: 15 |
Post Options
Thanks(0)
Posted: 24 April 2012 at 9:03am |
Hi there
I have a CXTPPropertyGrid which I empty and repopulate each time a user clicks between items on a CXTPReportControl. When the repopulation is complete, the scrollbar and scroll position of the PropertyGrid always reset back to the top, which can be frustrating for users if they are viewing fields at the bottom of the scroll view, so I'd like to be able to store the current scroll state of the property grid prior to updating, and reapply it after the control has been repopulated. The property grid will always contain the same number and type of fields so it is safe to re-use the scroll position, but I'm just not sure how to do it. What I have tried so far is: SCROLLINFO si; CXTPPropertyGridView & vView = pPropertyGrid->GetGridView(); vView.GetScrollInfo(SB_LINEDOWN, &si);
But this doesn't seem to work. I've also tried vView.SetScrollInfo(SB_LINEDOWN, &scrollinfo);andvView.SetScrollPos(SB_LINEDOWN,scrollinfo.nPos);but they didn't work either, so I'm stuck as to what to try next.Any help would me much appreciatedEric |
|
mgampi
Senior Member Joined: 14 July 2003 Status: Offline Points: 1201 |
Post Options
Thanks(0)
|
Hi;
Have you ever tried using CXTPPropertyGrid::GetTopIndex(), CXTPPropertyGrid::SetTopIndex() to position to the previous visible region? But you also have to save/restore the expand/collapse state of each item in the control. |
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
ericchubb
Groupie Joined: 31 May 2010 Location: Ireland Status: Offline Points: 15 |
Post Options
Thanks(0)
|
Hi Martin,
Thanks for your reply. I tried GetTopIndex but it returns 0 every time regardless of the scroll position of the the grid. I also tried invoking GetTopIndex on the property grid's view member object but again , no difference. Eric
|
|
Eric
Product: Xtreme Toolkit Version 22.0 Platform: Windows 11 (64bit) - Language: Visual C++ 2022 /C# .NET 2/3.5/4/5/6/7 |
|
mgampi
Senior Member Joined: 14 July 2003 Status: Offline Points: 1201 |
Post Options
Thanks(0)
|
Hi;
This sounds like a bug! Perhaps you should open a support ticket. |
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |