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

  • HI ,
    post  a snap  of  your code  to  let  us  provide  you with  the right solution .

    A man's dreams are an index to his greatness
    Friday, November 27, 2009 8:31 AM
  • HI ,
    post  a snap  of  your code  to  let  us  provide  you with  the right solution .

    A man's dreams are an index to his greatness
    Ok, I uploaded my little project:

    Please help me. Thanks.
    Friday, November 27, 2009 9:34 AM
  • Hi

    I are you try to implement an intellisence feature?
    If so you can probably use this as a reference for the handling of events and showing and hiding


    Friday, November 27, 2009 11:32 AM
  • Hi Le Vo Quang,

    I believe you are looking for something similar to a auto-complete property.

    Check this article out: Here, the textbox offers a similar pop-up as in your picture.


    also, http://www.dotnetfunda.com/articles/article225.aspx

    This emphasizes on the properties:
    AutoCompleteMode, AutoCompleteSource, AutoCompleteCustomSource

    Hope this helps...

    • Edited by BA_Newbie Friday, November 27, 2009 11:59 AM new link added
    • Proposed as answer by BA_Newbie Monday, November 30, 2009 8:27 AM
    • Marked as answer by liurong luo Thursday, December 3, 2009 8:09 AM
    Friday, November 27, 2009 11:57 AM