views:

352

answers:

0

In the application we are developing we would like to offer the user intellisense-type of editing facitilites when entering measurements. After entering a valid numeric value the user should enter the corresponding unit. To enter a valid unit, a list of valid units pops up in a listbox, see enclosed screen-shot. To change the currently selected item the user should either:

a. Type letters in the TextBox, causing the selection of the listbox to be adjusted to the best match

b. Use arrow keys to navigate the listbox

c. Use mouse to scroll the listbox

Screen shot

To make a selection, the user should either:

d. Press enter key

e. Click or double click the listbox

a), b) and d) is working fine. User may also scroll the listbox (c). However when clicking/double clicking an item in the listbox (e), the EditorWithText looses focus which triggers validation before being able to make the selection from the listbox. In the current implementation, we have made a subclass of EditorWithText which on AfterEnterEditMode instantiates a listbox to contain the valid units and adds this to the TopLevelControl to make it visible on top of other controls; on AfterExitEditMode the listbox is removed from the TopLevelControl to allow for its disposal. But, as already said, this implementation does not allow the user to select from the listbox using mouse click/double click. We have looked into how to use SupportsDropDown, DropDownManager, DoDropDown and DoCloseUp, but this wasn’t quite clear. We would appreciate any advice on how to make this work, and whether we should pursue the use of DropDownManager to solve this. If you have any example from a similar case, that would be great.

Thanks, Bjørn Egil