Real Software Forums
http://forums.realsoftware.com/

ListBox ScrollTo behavior workaround needed
http://forums.realsoftware.com/viewtopic.php?f=23&t=47896
Page 1 of 1

Author:  dgdavidge [ Thu May 16, 2013 11:55 am ]
Post subject:  ListBox ScrollTo behavior workaround needed

The ListBox ScrollTo function scrolls the data up or down until the specified row is shown, either at the top or bottom of the listbox. For example, with a listbox that shows 8 rows, scrolling from the top to row 21 shows rows 14 to 21 while scrolling from the bottom shows rows 21 to 14.

I am trying to make an alphabetical index for that will scroll the listbox to the first occurrence of the selected letter. It works, but I would like it to show the same data no matter whether it is scrolling up or down to get there. For that, I need to know what is showing in the listbox to start with so I can tell if it will be scrolling up or down. Is that possible with RS? or maybe XOJO next month?

If I was working with PHP, I could get the position using Javascript, but I have no idea how to refer to any of the DOM objects. Is there any documentation on this?

Author:  DaveS [ Thu May 16, 2013 12:00 pm ]
Post subject:  Re: ListBox ScrollTo behavior workaround needed

do a Scrollto 0 ...and THEN scrollto where you want to be.....
if you disable the control first... it should not flicker

Author:  dgdavidge [ Thu May 16, 2013 12:08 pm ]
Post subject:  Re: ListBox ScrollTo behavior workaround needed

I already tried that. It doesn't work with Chrome running in the Windows debugger. I haven't tried it anywhere else yet.

Author:  dgdavidge [ Thu May 16, 2013 1:59 pm ]
Post subject:  Re: ListBox ScrollTo behavior workaround needed

Problem solved. Instead of using ScrollTo(0) at the start, I scrolled to the bottom so that when it scrolls back up to the first row starting with the desired letter. The code to scroll to the desired line goes in a timer. Disabling the listbox did not prevent the scrolling down then back up, but with a timer period of 100, its just one continuous movement that's too fast to see what it is really doing.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/