Help me create a popup RRS feed

  • Question

  • Hello everyone,
    I lost more 2 week to finish a custom control which will display a popup window but I failed :(.
    I want to create a popup window which is same as popup window in combo box to display suggestions. See this screenshot:
    User will input text on my textbox, and popup will be displayed with suggestions which user can click to choose.

    This is my steps:
    - I will use a textbox for custom control.
    - Use a form for popup window with TopMost = true.
    - When popup is displayed, textbox will lose focus, and user can't continue to input. So, when popup is displayed, I will set focus to textbox again. With this way, user can continue to input anything.
    - And I will catch LostFocus event on textbox so that I can close the popup when textbox lost focus. However, when I try to click on the popup, the Lost Focus event on textbox will happen before I click to choose on popup -> this cause the problem: because textbox lose focus before, Popup will be hidden before, and so, I clicked on hiidden popup -> no affect.

    Please help me the way to make a custom control like this. Please don't ask me why I don't use combobox for my custom control. Because my popup is more features, not simple as combobox' popup.
    And I also ask myself which control is used as a combobox's popup? I used a lot controls for popup such as: form, dropdowntoolstrip, control but failed.

    Finally, I summary requirements for my custom control:
    - When user input text on my custom control, a popup will display suggestions for choosing. And user can still input anything.
    - When I click on the main form (form contains my custom control), if mouse's point is't in the display rectangle of my custom control and popup window, the popup window will be hidden. Example: when I click on titlebar of mainform, the popup will be hidden.

    I think this is a difficult problem.
    Please help me. An example is better.
    Friday, November 27, 2009 8:23 AM


All replies