• Welcome to PlanetSquires Forums.
 

Listbox single click

Started by Noble D. Bell, December 16, 2007, 06:03:09 PM

Previous topic - Next topic

Noble D. Bell

I am sure this has been answered here before but I cannot seem to find it.

I have a listbox control and I want the user to be able to select an item in the list by clicking on it one time. I would like for the selection rectangle to remain so that the user knows which one they selected. Right now the "blue" selection rectangle flashes when the user clicks on the item and then goes away.

Anybody point me in the right direction on this one?

nb

TechSupport

You must be doing something in the LBN_SELCHANGE message for the ListBox that is causing the focus to change to another control or set the selected listbox item to null ? Normal operation of the ListBox would dictate that the ListBox selected item will stay highlighted.

Noble D. Bell

You are right, once again!!

:-[  I put code in the WM_COMMAND section to load the list box with filenames from a directory. That was the problem. I moved the code to the WM_CREATE event and everything is back to normal. In looking back, I assume that if you are going to perform any startup code like loading listboxes or controls with initial values that you do not do it in the WM_COMMAND event??

nb

TechSupport

Quote from: Noble D. Bell on December 16, 2007, 08:21:48 PM
In looking back, I assume that if you are going to perform any startup code like loading listboxes or controls with initial values that you do not do it in the WM_COMMAND event??

That's right - use the WM_CREATE message to do any initializations. The controls exist at that point but are not yet shown on the screen.