views:

311

answers:

2

I'm trying to make a combo box that behaves somewhat like the Firefox 3 Awesomebar, with the following behavior:

  1. Type in text
  2. Asynchronously bring back results
  3. Up and down selects results in the list, BUT leaves the text that was typed in the entry box so the user can continue editing to limit the resultset differently
  4. Enter fires an event that the parent form will handle

I have the asynchronous results and filtering all working, but I don't have a good method for displaying and selecting within the results.

A combo box automatically fills the entry box with what is selected when you arrow down. Fails #3.

I've got the DevExpress controls, but their combo box does the same thing and I can't figure out how to override either.

A LookupEdit does not allow typing arbitrary stuff. Neither does a PopupContainerEdit.

I want behavior that's like a textbox with a listbox below it, and up/down events in the textbox get passed to the listbox. But if I try to make a custom control that combines the two like that, I have no clue how to "float" the listbox like the dropdown on a normal combo box.

Clues much appreciated!

+2  A: 

You may need to use a textbox instead of a combo box because using the arrow keys is selecting values from the combos list and overwriting your current value. By using the textbox you can do you lookup in the TextChanged event and you can store the currently typed value by overriding the KeyPress event to collect and store the keys the user has typed.
You popup list of values would have to be self drawn in the paint event.

This may seem overly complicated but you probably need to drop the combo control and implement some of its functions yourself.

benPearce
It's a pain, but it does seem like this is the only way.Can be slightly simpler by just displaying a ListBox floating below, not letting it have focus, and forwarding up/down key events to it.
Dan Fitch
+2  A: 

I've been using the AutoComplete control from Skybound. It's free. It can be customized, so that it can approximate the behavior from the Awesomebar.

http://dev.skybound.ca/Products/AutoComplete/

hectorsosajr
This control in databound mode does pretty much exactly what I want. ROCK! Thank you!
Dan Fitch
One is glad to be of service. :)
hectorsosajr
Ah, problem: I want to be able to have "text" return completion options like "string text in the middle" and "some more text". I can't figure out how to override the default filtering that's matching only at the beginning, and provide my own. Do I need to buy a license to get the source?
Dan Fitch
I don't know the answer to that, but you could ask them. Look at the link at the bottom of that page on the link. It read "Ask A Question." I've gotten answers from them before.
hectorsosajr
They actually told me their control doesn't support what I want to do - fast response though, so thanks for that... they recommend just displaying my own floating listbox, which I've tried and isn't quite as simple as it should be... can't believe there's no drop-in control for this!
Dan Fitch