Forum Discussion

setha's avatar
setha
New Contributor
13 years ago

how to get rownumber of currently visible rows?

Hi,



I have a testcase the intent of which is to scrolls in increments through a Viewport object waiting after each scroll until the rows no longer display "Loading..."  in the cells.

There may be as many as 2+ million rows of data; the Viewport displays 16 rows at a time.



For the first two scrolls this works as expected but after that it scrolls through the rest of the table without waiting even though rows all display "Loading..." still.



I assume this is happening because getValueAt(0, 0) is trying to get the first rows of the table and after scrolling we no longer have access to them?



My question is how can I get the rownumber of the first VISIBLE row in the table?



Here's a snippet of code:



Dim i

Dim scrollIncr

Dim rowValue

set scrollBar = GDTablePanel.DefaultOverlayable.GTablePanel_4.VScroll

'get position at max scroll...

scrollBarMax = scrollBar.Max

'set maxEntries

log.Message("Max is " & scrollBarMax)

'...and divide by 10 to get the positions to scroll to

scrollSegment = scrollBarMax / 10

i = 0

For i = 1 To 10

    scrollIncr = scrollSegment * i

    log.Message("Scrolling to " & scrollIncr)

    scrollBar.Pos = scrollIncr 

    'need to wait after each scroll until "Loading..." no longer displays in table

    while GTablePanel_4.Viewport.Event_Log.getValueAt(0, 0).toString = "Loading..." 

        aqUtils.Delay(10) 

    Wend

'when "Loading..." no longer displays go on to next scroll action

Next



Thanks!

1 Reply

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Hi Seth,



    The answer depends on the specific control in question, and it's difficult to say anything without knowing what control you are talking about. If you post here some more details, such as the control type, the class name and vendor, the application type (.NET, WPF etc.) and, maybe, some screenshots of the Object Browser, we could come up with some suggestions.



    By the way, I see that you're using some native object methods in your script. Have you tried looking through the control's properties and methods list in the Object Browser and checking whether there was anything relevant? For example, there might be a method named getTopRow, or getFirstVisibleRow, or something like that. Tip: you can use the search box to filter/search the method list by a keyword.