pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Volkert <tvolk...@gmail.com>
Subject Re: Tableview auto-scroll to bottom
Date Fri, 26 Feb 2010 11:29:10 GMT
No problem :)

Basically, components are sized and positioned (and painted) on a separate
event loop than your application code (for performance reasons).  So if you
add data to your table data, the table view says "I'll need to grow myself
to accommodate this new data... but I'll wait until the next event loop".
Thus, *immediately* after you add that table data, the table view is smaller
than it needs to be.  So if you tell it to scroll to the bottom, it'll only
scroll to the bottom based on its too-small size.  By queueing a callback,
you're saying "let the table view grow to its needed size, *then* scroll to
the bottom".

You won't run into these cases that often, but they come up every now and
then.

-T

On Fri, Feb 26, 2010 at 6:15 AM, Mathias Versichele <
mathias.versichele@gmail.com> wrote:

> Don't exactly know what that code does, but it works :-) Thanks
>
> 2010/2/26 Todd Volkert <tvolkert@gmail.com>
>
> My guess is that you're calling this after the table view has been
>> invalidated but before it's been laid out.  In cases such as these, you have
>> to queue a callback, like this:
>>
>> ApplicationContext.queueCallback(new Runnable() {
>>     @Override
>>     public void run() {
>>         // Perform scrolling here
>>     }
>> });
>>
>> Cheers,
>> -T
>>
>>
>> On Fri, Feb 26, 2010 at 3:05 AM, Mathias Versichele <
>> mathias.versichele@gmail.com> wrote:
>>
>>> I'm not calling it in response to a Task Listener, and I can navigate to
>>> the bottom with the arrow keys without any problems.
>>>
>>>
>>> 2010/2/25 Greg Brown <gkbrown@mac.com>
>>>
>>>> Another question - can you use the arrow keys to navigate to the last
>>>> row?
>>>>
>>>> On Feb 25, 2010, at 3:40 PM, Mathias Versichele wrote:
>>>>
>>>> It gets stuck about 6 rows from the bottom, so it doesn't work
>>>> perfectly...
>>>>
>>>> 2010/2/25 Greg Brown <gkbrown@mac.com>
>>>>
>>>>> Try this, let me know if it doesn't work:
>>>>>
>>>>>   int n = tableView.getTableData().getLength() - 1;
>>>>>   tableView.scrollAreaToVisible(tableView.getRowBounds(n));
>>>>>
>>>>>
>>>>> On Feb 25, 2010, at 3:06 PM, Mathias Versichele wrote:
>>>>>
>>>>> How do you make a tableview automatically scroll to the bottom when new
>>>>> rows are added ?
>>>>>
>>>>> --
>>>>> Mathias Versichele
>>>>> Bio-ir milieutechnologie / Msc. geografie
>>>>> Oudburgstraat 16
>>>>> 9240 Zele
>>>>> 0485/16.07.08
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Mathias Versichele
>>>> Bio-ir milieutechnologie / Msc. geografie
>>>> Oudburgstraat 16
>>>> 9240 Zele
>>>> 0485/16.07.08
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Mathias Versichele
>>> Bio-ir milieutechnologie / Msc. geografie
>>> Oudburgstraat 16
>>> 9240 Zele
>>> 0485/16.07.08
>>>
>>
>>
>
>
> --
> Mathias Versichele
> Bio-ir milieutechnologie / Msc. geografie
> Oudburgstraat 16
> 9240 Zele
> 0485/16.07.08
>

Mime
View raw message