www.sdlsuite.com Forum Index www.sdlsuite.com
Discussion of technical aspects of the SDL Component Suite
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TReportListView showing rows programmatically

 
Post new topic   Reply to topic    www.sdlsuite.com Forum Index -> GuiPack
View previous topic :: View next topic  
Author Message
fburton



Joined: 08 Jan 2007
Posts: 9

PostPosted: Wed Nov 05, 2008 10:29 am    Post subject: TReportListView showing rows programmatically Reply with quote

Hi,

I have a ReportListView to which I add rows such that the scrollbar appears and the added rows are no longer in view. I would like a way to make the last added row visible programmatically so that the user doesn't have to constantly scroll to the bottom of the table. Is there a convenient way to do this?

Cheers,
Francis
Back to top
View user's profile Send private message
fburton



Joined: 08 Jan 2007
Posts: 9

PostPosted: Wed Nov 05, 2008 7:13 pm    Post subject: Reply with quote

I found the property TopRow which does exactly what I need:

"The property TopRow specifies the index of the first visible scrollable row in the grid. Setting TopRow scrolls the rows in the grid so that the row with index TopRow is the first row after the header."

(Not sure how I missed it the first time I looked at the help file.)
Back to top
View user's profile Send private message
ozanen



Joined: 24 Jan 2011
Posts: 3

PostPosted: Mon Jan 24, 2011 7:52 pm    Post subject: reportlist control row that has the focus Reply with quote

TopRow programmatically selects the toprow and while scrolling maintains that condition.

if you want to provide the user and overview it would be nice to programmatically have a center row be selected and kept centered while scolling through the data.

Toprow does not provide that functionality: does anybody knows of some lines of source that provide a work-around?
Back to top
View user's profile Send private message
hlohning



Joined: 08 Sep 2006
Posts: 277
Location: Austria

PostPosted: Wed Jan 26, 2011 4:21 pm    Post subject: Reply with quote

Just an (untested) idea:

Code:
CenterRow := TopRow + VisibleRowCount div 2;


Please let us know whether this works.

Regards,

Hans
_________________
Hans Lohninger
Software Development Lohninger
http://www.lohninger.com/
Back to top
View user's profile Send private message Visit poster's website
ozanen



Joined: 24 Jan 2011
Posts: 3

PostPosted: Wed Jan 26, 2011 8:07 pm    Post subject: tried solution: CenterRow Reply with quote

CenterRow is not listed in the 9.7 help system.

tried RowSelected[TopRow + VisibleRowCount div 2] instead

but that does not seem to work since ColorSelectedRow does not indicate anything happening.

scrolling works
Back to top
View user's profile Send private message
hlohning



Joined: 08 Sep 2006
Posts: 277
Location: Austria

PostPosted: Thu Jan 27, 2011 7:21 am    Post subject: Reply with quote

OK, maybe I did not fully understand your intention. Here's a code snippet which I wrote for my own purposes. The procedure CenterScrollSelect selects the row 'Row' and scrolls the grid 'RL' such that the selected row is displayed in the center of the list view.

Code:
procedure CenterScrollSelect (RL: TReportListview; Row: integer);

var
  selgrid : TGridRect;

begin
RL.DeselectAllRows;
RL.RowSelected[row] := true;
RL.TopRow := row-(RL.VisibleRowCount div 2);
selgrid.Top := row;
selgrid.Bottom := row;
selgrid.Left := 1;
selgrid.Right := RL.NrOfColumns;
RL.Selection :=  selgrid;
end;


Is that what you are looking for?
_________________
Hans Lohninger
Software Development Lohninger
http://www.lohninger.com/
Back to top
View user's profile Send private message Visit poster's website
ozanen



Joined: 24 Jan 2011
Posts: 3

PostPosted: Thu Jan 27, 2011 5:20 pm    Post subject: Reply with quote

Hans,
This works like a charm. highly recommend to add to the examples i guess.
this is how i called the procedure:
CenterScrollSelect (ReportListView_xyzT,ScrollBarDefectLocator.Position);

thanks very much [have been using your product for more than 10 years now]
Olivier
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.sdlsuite.com Forum Index -> GuiPack All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group