Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MultiSelect Listbox Programmatic Selection Quirk
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
MultiSelect Listbox Programmatic Selection Quirk
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01126812
Message ID:
01126812
Views:
83
I have code that programatically selects values in a multi-select listbox whose source is 3-SQL Statement.

I've already discovered one quirk in that the multiple selections won't be highlighted properly unless you issue a wait window with a short timeout between selections as such:

FOR x=1 TO this.ListCount
IF this.list(x,1)=something
this.selected(x)
wait window 'found' timeout .1
ENDIF
ENDFOR

Unless I include this wait window I can not get a multi-select to properly select multiple lines. Without the wait window Only the last selected line will end up selected and then only with the little dotted outline. If I keep the wait window in the code then all the selected lines are properly highlighted dark blue.

On to the quirk that I can't figure out for the life of me:
The above code works fine until the user clicks in the listbox. As long as the user hasn't clicked in the listbox the above code will work over and over again (as a search function). The moment the user has clicked in the listbox, the above code no longer works as only the last selected line ends up selected and instead of being highlighted it just has the little dotted outline.

This has got to be some sort of quirk in Foxpro. If I issue a wait window 'test' timeout 1 as the last line of code you can see the multiple lines highlighted properly. As soon as the wait window disappears so do the highlights of the multiple selections leaving only the little dotted outline on the last selected line. I've stepped through the with the debugger to confirm that no other lines of code are running after the wait window.

Does anyone have any ideas? It's driving me insane!
Brandon Harker
Sebae Data Solutions
Next
Reply
Map
View

Click here to load this message in the networking platform