- Daniel Vivier
- PowerBuilder
- Tuesday, 21 September 2021 04:54 PM UTC
I thought this would be easy, but I'm stuck trying to find code to scroll a given row to become the top row of a DataWindow. I can get the desired row into the display with ScrollToRow(row) but nothing I have tried (including some proposed solutions at https://answers.sap.com/questions/12112836/how-to-view-a-specific-row-as-the-first-row-on-pag.html) has worked.
Once suggestion was to use dw.Scroll(n) to scroll the window up, but it doesn't seem to actually do that. The docs for the DW Scroll method actually seem really confused (this is PB 2019) saying you call it on a DW, then saying it "Scrolls the edit control of a DataWindow a specified number of lines up or down" (what edit control)? And the example code at the bottom of that Help topic calls it on an MLE, not a DW!
You can't use further calls to ScrollToRow() on rows that are out of view, because that tends to scroll the passed-in row to the middle of the visible rows, not to a specific desired position.
I also tried ScrollNextRow(), but if you call it when the current row is the last row on the page (dw.Object.DataWindow.LastRowOnPage), it does nothing. If you call it again right after that, the row below that last row currently displayed moves up to become the first row displayed, rather than scrolling up by one row!
So I really can't see that there's any DW API function that I haven't tried yet that ought to do this properly. Any bright ideas?
Thanks.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.