Jump to content


Photo

Looking for ScrollToCenter;


  • Please log in to reply
3 replies to this topic

#1 DelphiToday

DelphiToday
  • Members
  • 105 posts
  • Gender:Male

Posted 09 February 2021 - 09:26 PM

Hello Boki,

 

I am looking for a function ScrollToCenter to get the selected one neatly in the middle of the VISIBLE screen VirtualNextgrid. That is much nicer. :)

Let's say screen top is position 10 and screen bottom position 20 it must jump to position 15.

 

I now use: SelectCell(0, FoundIndex); but that jumps always to bottom in View not center.

Hope you understand problem.

 

You now have:

 

procedure TNxCustomGrid6.ScrollToBottom;
procedure TNxCustomGrid6.ScrollToCell(ACol, ARow: Integer);
procedure TNxCustomGrid6.ScrollToSelected;
procedure TNxCustomGrid6.ScrollToTop;

 

Will you make a new function?

 

I need this very fast so can I do this with little trick myself???

 

Regards,

Eduard.



#2 DelphiToday

DelphiToday
  • Members
  • 105 posts
  • Gender:Male

Posted 11 February 2021 - 07:02 AM

I now use this little code to center position. Maybe you understand better.

{ Add Record }
WikiArtistObject.AddArtist(ArtistStr);
WikiArtistObject.DoSort;
NextGridExt.DataChanged;

{ Lookup added 'Artist' }
NextGridExt.SelectCell(0, FoundIndex); 

{ Calculate and center position }
F := ReportGridView.FirstIndex; // 506 (sample)
G := ReportGridView.GetRowCountInPage(F); // 30 (sample)
P := F + (G div 2); // 521 (result)

NextGridExt.VertScrollBar.Position := P; //

Please let me know. :)

 

Regards,

Eduard.
 



#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,956 posts
  • Gender:Male

Posted 12 February 2021 - 11:12 AM

Hello Eduard,

 

Please sorry for delay, but I think that your solution is good. I'm not sure if I will include it in official code.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#4 DelphiToday

DelphiToday
  • Members
  • 105 posts
  • Gender:Male

Posted 12 February 2021 - 11:59 AM

That's fine. I will create my own function.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users