ListBox Like Delphi's Code Complete
Posted on 2002-07-09
I'm trying to make a ListBox decendent that works like Delphi's Code Complete/Insight TPopupListBox. I am not concerned with _when_ the ListBox should popup, but _how_ to make the ListBox popup and work properly.
I know that for this to work properly the ListBox should have the windows desktop set as its parent (the same way that Delphi's does), and an "invisible" window/WindowProc assigned with AllocateHWND; also it should SetFocus to the associated Memo immediately after appearing. But, I am stuck after that point.
The real problem seems to be how to hide/show the ListBox. The SetWindowPos API does not seem to be very effective -- when the ListBox does get shown, if at all, it contains items but none of the items' text/images are visible.
Can anyone show me the right way to make this work?
* Also, I have tried using a Form (with fsStayOnTop set), but this creates additional focus problems (e.g. hiding the Form/ListBox when the mouse is clicked elsewhere), so I would prefer to avoid this method.