Using the PenInputPanel Object with Combo Boxes
Using the PenInputPanel Object with Combo Boxes |
Description of using the PenInputPanel object with combo boxes.
If you attach a PenInputPanel object to a ComboBox control, then tap your tablet pen on the edit control portion combo box at runtime, the PenInputPanel object does not appear. However, it does appear if you tap on the dropdown arrow. This is because the window of the edit control in the combo box is not the window that receives pen messages. Combo boxes have a child edit window. The solution to this problem is to determine whether the window the PenInputPanel object is attached to has a child window. If so, you can attach the PenInputPanel object to the child window.
The following Microsoft® Visual Basic® example demonstrates how to attach a PenInputPanel object to the child window of a combo box control.
Dim WithEvents thePenInputPanel As PenInputPanel
Const GW_CHILD = 5
' Declare the Win32 GetWindow fuction
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, _
ByVal wCmd As Long) _
As Long
Private Sub Combo1_DropDown()
thePenInputPanel.Visible = False
End Sub
Private Sub Combo1_GotFocus()
Dim hwndChild As Long
hwndChild = GetWindow(Combo1.hwnd, GW_CHILD)
If hwndChild <> 0 Then
thePenInputPanel.AttachedEditWindow = hwndChild
End If
End Sub
Setting the VerticalOffset property of the PenInputPanel object to a value of -1 makes the panel appear on top of the combo box.