noble
Mar 7th, 2001, 01:29 PM
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.
Chris
Mar 8th, 2001, 03:25 AM
noble, is this you looking at?
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