1 Attachment(s)
[RESOLVED] Show 2 controls as selected at same time
I have a text box and a listview.
When the user types into the text box it searches the listview for any matches. (Auto-complete)
What I would like to be able to do is have both the text in the textbox and the selected item in the listview highlighted, as in the picture below, preferably keeping the focus on the textbox.
Anybody know how to do this? I am guessing some osrt of API call. :confused:
Re: Show 2 controls as selected at same time
Make sure HideSelection is set to False for both controls.
Re: Show 2 controls as selected at same time
Doesn't this select the Listview, but not in the 'Blue' highlighted colour?
I was hoping to get both the same, as in the picture.
I can't quite test it yet as I am having trouble here in this thread :cry: (Thread sorted now)
Re: Show 2 controls as selected at same time
You could use a listbox instead of a listview. Assuming you don't want to do that, I know you can set the color of listview items. Not sure if that includes the background color, but I imagine it might.
Re: Show 2 controls as selected at same time
Quote:
Originally Posted by aikidokid
Doesn't this select the Listview, but not in the 'Blue' highlighted colour?
It keeps the selected text highlighted even when the control looses focus.
Re: Show 2 controls as selected at same time
That's a gray highlight, not the standard blue one. (Inactive highlight.)
Re: Show 2 controls as selected at same time
Re: Show 2 controls as selected at same time
Quote:
Originally Posted by zynder
Thanks zynder, I have just been looking at them :D
So, in your original post (2006) did you end up using a ListBox instead, or did you settle for not having the ListView highlighted the same as the ListBox image?
Re: Show 2 controls as selected at same time
I used listbox instead. I didn't bother to mimic the effects of listbox to a listview control. You see, the highlight color isnt blue but gray. But i know you can subclass it and actually draw the color you want but i dont want get myself into more trouble.
So i ended up using listbox and the autocomplete is perfect. But in your case since you're using multi columns better stick to listview although you can span it in listbox using vbTab. Well, it's up to you.
Re: Show 2 controls as selected at same time
Quote:
Originally Posted by zynder
I used listbox instead. I didn't bother to mimic the effects of listbox to a listview control. You see, the highlight color isnt blue but gray. But i know you can subclass it and actually draw the color you want but i dont want get myself into more trouble.
So i ended up using listbox and the autocomplete is perfect. But in your case since you're using multi columns better stick to listview although you can span it in listbox using vbTab. Well, it's up to you.
I think I will have a little play with it and see what I end up with.
Thanks for your help and the code samples :thumb:
Re: Show 2 controls as selected at same time
No problem dude. If you have any problems just let us know.
Re: Show 2 controls as selected at same time
Changed the form and code about a bit and now I have what I was after, but using the listbox, not the listview.
Thanks all who helped :D