getDspSize() of TEXTGRIDCollection problem

Hallo Bjoern.

Thanks a lot. It works as described.


Hi Bjoern.

Regarding to my TEXTGRIDCollection question I have the following problem. I want the current selected row to be visible and centered or as last visible row in my TEXTRIDCollection.

Currently I’m using setTopIndex(int index) to make the current selected row visible in my list. But here comes the problem. Is the current row the last row in my List, only this row is visible. Even if my List is short enough to fit into the list area. I get a scrollbar and the User has to scroll the list manually to see the begin of the list.

I tried to manipulate the list using setTopIndex() and a negative index offset. The idea was to get the number of visible rows, subtract this from my index, use this for setTopIndex() and finally manipulate the current selected row Item. So my current selected row would end up as the last row in list.

Now I guess the problem here is that the number of visible rows is not known before the List has been rendered. Right?

How can I solve this problem?


…you exactly described the problem. For the first shot there is no chance - other than doing a guess…

Befor anyone comes with this “super-tricky” approach: you could add a TIMER to page with interval “10ms” and interval not defined in a fix way (!) but by property. After the timer having run the first “shot” after the init-shot of the page you could set back the timer to “0”, meaning that the timer is stopped.
Do we really like this approach?.. One roundtrip extra needs to be done.


BTW: …please: do not define your ROWCOUNT too high. It will speed up the runtime execution of the page. Something above 50 always sounds a bit unhealthy. Something like 30 sounds healthier…

Hi Bjoern.

Thanks a lot but I don’t really like the TIMER approach. That’s a bit over the top.

My solution is a mixture of getRowCount() and a guess. If getRowCount() results in >0 then I use --(getRowCount()) to position my current row.

If the page has not been rendered yet and getRowCount() == 0, I use three rows as offset instead. This kind of guess is only needed the first time. From then on the number of rows is known. This works fine and there is not many table flickering going on.

Again, thanks for your help and quick reply