Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to ... with a listbox?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
How to ... with a listbox?
Miscellaneous
Thread ID:
00228517
Message ID:
00228517
Views:
36
I have a listbox on a form. The user does a search on certain criteria and matching records are listed in the listbox. Then, I let the user chooses one of the records in the listbox by clicking on it with their mouse. That works the way I want it to...

But I also want to give the user the capability to use the up arrow and down arrow keys to move to the record in the list and then press the Enter key to choose it. But I also want to retain the mouse method.

That way the user can select a record from the listbox using keys or the mouse. When I press the down arrow key to move down the list, when I hit the last item in the list, it gets selected and I have not pressed Enter.

When I click the mouse or press Enter I have the form unload/release and return me to the calling form with the selected record appearing in the calling form.

I have some code in the Keypress Event of the listbox to handle pressing the Enter key, but why can't I move up and down the list using the arrow keys without being thrown out of the form and sent back to the calling form? Then I always end up with the last item on the list as my selected record.

Any ideas on how to handle the key pressing and scrolling using up/down arrow keys in the listbox better? Thanks for helping me.

Once I see the best way to do it, I have many forms that I can apply the technique to.
Steve Kramer
Kramer & Kramer Design
"Home of Go Cartoons"
Web Site: www.stephenkramer.com
Would you believe Far Side Lite?
More than 270 original cartoons.
Reply
Map
View

Click here to load this message in the networking platform