Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Listbox Problem (Repost)
Message
From
21/06/1999 10:04:43
Paul Frost
Instem Computer Systems Ltd
Stone, United Kingdom
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00229988
Message ID:
00232096
Views:
16
>Did you ever find a solution to this? Why do you want the list to auto-scroll?
>
>>I didn't get a reply last time I sent this, ( DevCon was more important I guess), so I'm trying again.
>>
>>On a form I have a listbox, with RowSourceType=7 (Files) & RowSource="images\*.jpg".
>>
>>I want the user to have an auto-scroll facility, so have added a timer to the form, with the following code in the Timer event
>>
>>thisform.listbox1.ListIndex = thisform.listbox1.ListIndex+1
>>
>>(there's a bit of checking to make sure I don't go past the end of the list).
>>
>>What I have found is that without the timer enabled, I can change drives/directories by clicking on the appropriate entries in the displayed list with no problems. If I enable the timer & allow a timer event to take place, then the listbox acts as I expect it to, scrolling through the list.
>>
>>The problem is if I change drive/directory first, by clicking on the entries in the list, & then enable the timer & allow timer events to take place, then disable the timer & try to change drive/directory, I am placed straight back to the original directory & have to work my way back to where I want to be.
>>
>>I've tried this with a button as well & it appears that a programmatic change of ListIndex, causes this problem.
>>
>>Am I doing something wrong or have I run into a problem with programmatically changing the ListIndex property.
>>
>>TIA
>>Paul

The solution I ended up with was to modify RowSource to reflect the current directory, after interactively changing the directory.

This solution never answered the problem of why an interative change (e.g. clicking on item) retained the directory, whereas a programmatic change caused a reset to the directory specified by RowSource on the next interactive change.

The directory contains a number of images the user may want to browse to select from, the currently selected image is displayed next to the list box. I thought it might be a nice idea to have an automatic browse facility, rather than require manually moving through the list, hence the 'autoscroll' using the timer.

Thanks for replying, if you've any idea why I'm getting the problem, I'd still be interested - I'd prefer to correctly fix the problem than have to work around it.
Paul
Previous
Reply
Map
View

Click here to load this message in the networking platform