Jump to content


Photo

LastRowInView


  • Please log in to reply
9 replies to this topic

#1 Alex

Alex
  • Members
  • 17 posts

Posted 15 November 2016 - 06:16 PM

Hello, how do I set (scroll to) First Row In View ? ScrollToRow sets row last in view. Ty.

 

PS. Wrong subject, sorry.



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 15 November 2016 - 06:53 PM

Hi,

 

In v6 you can use ScrollToCell(X, Y), or NextGrid61.ActiveView.ScrollToRow(Index).

 

In v5 you can use ScrollToRow(x).

 

In v5 you can scroll to first row in view with:

 

 NextGrid1.ScrollToRow(NextGrid1.FirstRow);

boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.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.

#3 Alex

Alex
  • Members
  • 17 posts

Posted 15 November 2016 - 07:09 PM

Thanks for reply, perhaps I didn't make myself clear. I need to scroll to specified row so it will be on top of the visible part of grid, ScrollToRow makes specified row visible at bottom of grid. There is a function in FireMonkey Grid called TopRow, I need a NextGrid function doing the same. Using version 5 btw. 



#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 15 November 2016 - 07:17 PM

Hi,

Yes, grid only scroll enough for row to appear in view.

In case you didn't have invisible rows, you can use VertScrollBar.Position since it indicate first row in view.

But I will think about adding SetTopRow method or similar.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.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.

#5 Alex

Alex
  • Members
  • 17 posts

Posted 15 November 2016 - 07:23 PM

Thank you.



#6 Alex

Alex
  • Members
  • 17 posts

Posted 16 November 2016 - 03:48 PM

How can I avoid this infinite scroll when using VertScrollBar.Position ? I mean, when last row shown in bottom, I would like VertScrollBar.Position not to scroll more.

QF24hHY.png

 

Temporarily using after scroll pos change
nextgrid1.Height:=nextgrid1.Height+1;
nextgrid1.Height:=nextgrid1.Height-1;
but this is not good.


#7 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 16 November 2016 - 06:14 PM

Hi,

 

Maybe this will help: You can decrease VertScrollBar.Position by VertScrollBar.PageSize (this is a number of rows in view).

 

Unfortunately never needed (and requested) SetTopRow before. Maybe this can be one of the next features.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.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.

#8 Alex

Alex
  • Members
  • 17 posts

Posted 17 November 2016 - 03:39 PM

Sorry to bother you with this very minor issue, but I don't understand how VertScrollBar.PageSize can help.

 

You can reproduce this behavior by doing the following:

- Add grid, button, then add let's say 20 rows

- Try to scroll like this:

 
global variable:
 
var
  ccc: integer=0;

 

button:

 
inc(ccc);
nextgrid1.VertScrollBar.Position:=ccc;
 
 
Click button several times and you will see that scrolling doesn't stop when last row is shown...


#9 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 17 November 2016 - 06:54 PM

Hi,

 

Maybe something like this will help:

 

procedure TForm4.Button1Click(Sender: TObject);
begin
  inc(ccc);
  if ccc <= Succ(nextgrid1.VertScrollBar.Max) - NextGrid1.VertScrollBar.PageSize then
  begin
    nextgrid1.VertScrollBar.Position := ccc;
  end;
end;

boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.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.

#10 Alex

Alex
  • Members
  • 17 posts

Posted 18 November 2016 - 04:36 PM

Looks good, thank you!






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users