Skip to main content.

Archives

This is the archive for March 2006

AutoComplete for multiline edit control

By default the standard AutoComplete component provided with win32 does not support multiline edit control (i.e. edit control with the ES_MULTILINE style.)

After spending some time searching the web for an existing implementation, I didn't find anything as complete as the original implementation by Microsoft. So I decided to roll my own and here is the result:

AutoCompleteML

The implementation is based on observation of the behavior of the original implementation. In particular, the suggest drop down list disapears automatically when the user click anywhere on the screen. I've realized this trick by adding a hook and tracking mouse messages. The hook is only active when the suggestion list is displayed.

Another trick was to implement support for scrolling the suggestion list. Here Spy++ was really usefull to learn from the original win32 implementation. It also helped for the resize box. Eventually, I decided to not hide the vertical scrollbar to not have to customize the drawing of the resize box (as in the original implementation.)

One important trick when using Spy++ is to subclass the base classes, this allow Spy++ to display more complete information when logging messages from the window class's name.