Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


MS Visual C++ .... retrieving List Box selection

Posted on 2003-03-18
Medium Priority
Last Modified: 2013-12-13
To clarify...this is not a Dropdown, or combo box, but a list box with the Up/Down arrows to the right.

I have found that if I scroll through the box and stop on the desired selection from the list, that the selection is not assigned to the control's variable unless you actually click on the selection (and it changes colors). So a user, using only the arrows to find the desired selection, could stop at the right choice, and from all appearances, think that the displayed value will be submitted, but the selection actually didn't 'take'.

If there another EVENT that can be monitored for a selection made only by using the arrows? The "OnSelchange..." event is only invoked when the user actually clicks inside the box on the selection.

Incidentally, this is not the case with Dropdown lists (combo box). The "OnSelchange..." event function is executed without actually clicking the selection.

Question by:cox8355

Expert Comment

ID: 8169197
If the focus is inside the ListBox, which means there is a highlight bar inside it, keyboard navigation should produce selchange events.  If there is no highlighted bar, how could the user know what he or she is choosing?

Anyway, you could use GetTopIndex when the user clicks OK to get the first visible item in the listbox.


Author Comment

ID: 8176233
The user can change the displayed entry in the box by using the UP/DOWN scroll arrows. So the new selection is displayed, whether or not the user sets the focus inside the box by clicking on it.

The problem is, without clicking inside the box, (thus, no highlighted bar), the scrolled selection does not produce the "ONSELCHANGE" event, and the changed selection, though visible to the user, is not not addressed, since the function invoked by that event is not called. Is there an event just for the scrolling change, without clicking in the box? As is it, the user thinks a selection has been made, which is being ignored.

Accepted Solution

PlanetCpp earned 300 total points
ID: 8176362
you keep saying up/down arrows, are you talking about the standard scrollbar that's on the right of the listbox (if that style was indicated) or are you talking about the up/down arrows like the ones you can put into a textbox?
if you mean the latter then you must have put code to deal with the events coming from the arrow, post it.
i've never seen the up/down arrows added to a listbox though s  think you mean the regular scrollbar attached to it.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
No other job is as rewarding and demanding as building an iPhone app is. It is not really in the hands of the developer for the success of an iPhone app. Many factors operate jointly for every iOS application's success in the market.
Simple Linear Regression
Screencast - Getting to Know the Pipeline

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question