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

Scrolling in Datawindow without setting currentrow 2

Status
Not open for further replies.

Dinin7

Programmer
Nov 16, 2003
1
AT
Hy !

Wow can i vertical scroll in a Datawindow with a button (no vertical scrollbar) without setting the Currentrow ? The scrollbar does the job but i cannot use it because of GUI.
Can i trigger the scrollbar ?
I tried the functions like 'scrollnextrow', 'scroll', 'scrolltoRow' but my RowFocusindicator is always moved to the Row i scrolled.


 
You can use the VerticalScrollPosition attribute of the DataWindow object to set the first visible row in the DataWindow, but you will have to do a little calculation. The VerticalScrollPosition is a product of the row number of the first row on the page minus 1 and the Detail Band Height. So for example, to scroll the DataWindow to row 10 you could do the following:

Code:
Long ll_row, ll_pos

ll_row = 10
ll_pos = Long(dw_1.Object.DataWindow.Detail.Height) * (ll_row – 1)

dw_1.Object.DataWindow.VerticalScrollPosition = ll_pos

Note that this works a little different than the ScrollToRow or ScrollNextRow functions. As an example, if rows 1 through 10 are currently visible in a DataWindow and you call ScrollToRow(10), the set of visible rows will not change. However if you use the code above, the DataWindow will scroll to rows 10 through 19 (assuming there are at least 19 rows in the DataWindow). These are minor differences in behavior but you might need to keep them in mind in order to calculate the VerticalScrollPosition you need to get the results you want.

Good luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top