Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: How to unselect the text after populating a comboBox dropdown list


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Feb 16, 2015 1:20 PM Last Post By: John Baird
John Baird

Posts: 22
Registered: 6/15/09
How to unselect the text after populating a comboBox dropdown list  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 12, 2015 1:26 PM
Is there a way in which I can prevent the text in a combo box being selected (i.e. displayed in white lettering on a blue background) immediately after populating the dropdown list? I can avoid this in most circumstances e.g. after making a selection from the dropdown list but the specific situation where I want to avoid this happening is after the user has entered a few characters (e.g. v*) then pressed a search button. Setting selStart, changing the itemIndex or
shifting the focus back to the comboBox then away from it does not solve the problem. In this situation I want the first item (itemIndex 0) displayed without being selected.

TIA, John
Doug Hay

Posts: 122
Registered: 5/26/05
Re: How to unselect the text after populating a comboBox dropdown list  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 14, 2015 8:36 PM   in response to: John Baird in response to: John Baird
Have you tried sending a message to move the cursor to the end of the text, simulating the user pressing END?
John Baird

Posts: 22
Registered: 6/15/09
Re: How to unselect the text after populating a comboBox dropdown list  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 16, 2015 1:20 PM   in response to: Doug Hay in response to: Doug Hay
Doug Hay wrote:
Have you tried sending a message to move the cursor to the end of the text, simulating the user pressing END?

Thanks Doug, I had not tried that and it would almost certainly work.

I finally figured what was causing the text to become selected - changing the text colour. The dropdown list is populated with a number of usernames matching a search pattern and if the selected item (or item 0 immediately after a search) is expired or disabled, I display it in red. Setting SelStart to the end of the value immediately after changing the colour has solved the problem.

Thanks, John
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02