Results 1 to 2 of 2

Thread: combo box popup

  1. #1

    Thread Starter
    Hyperactive Member noble's Avatar
    Join Date
    Nov 2000
    Location
    Philly
    Posts
    471
    how do i make a combo box appear below my cursor
    position in a rich text box. I created an excellent
    auto-complete for the rtb but i need the combo box
    to popup underneath where i'm typing.

    Thanks for the help.
    Bababooey
    Tatatoothy
    Mamamonkey

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    noble, is this you looking at?

    Code:
    Option Explicit
    Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Const CB_SHOWDROPDOWN = &H14F
    
    Private Sub Form_Load()
        Combo1.Visible = False
        SetParent Combo1.hwnd, RichTextBox1.hwnd
    End Sub
    
    Private Sub RichTextBox1_KeyPress(KeyAscii As Integer)
        If KeyAscii = 13 Then Combo1.Visible = False
    End Sub
    
    Private Sub RichTextBox1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
        Combo1.Move x, y
        Combo1.Visible = True
        Combo1.ListIndex = 0
        SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, True, 0
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width