Share via


CurrentPanel Property

CurrentPanel Property

Gets or sets which panel type is currently being used for input within the PenInputPanel object.

Declaration

[C++]

[propput] HRESULT CurrentPanel (
    [in] PanelType CurrentPanel);
[propget] HRESULT CurrentPanel (
    [out, retval] PanelType *CurrentPanel);

[Microsoft® Visual Basic® 6.0]

Public Property Get CurrentPanel() as PanelType
Public Property Let CurrentPanel ( _
    theCurrentPanel as PanelType)

Property Value

PanelType The panel type currently used for input within the PenInputPanel object. The Handwriting panel type is the default value.

This property is read/write.

Return Value

HRESULT value Description
S_OK Success. The parameter contains the currently active panel.
E_FAIL An unspecified error occurred.

Remarks

Note: The CurrentPanel property cannot be set to Default or Inactive, only Handwriting or Keyboard.

When you create a PenInputPanel object, the Handwriting panel—also known as the writing pad—is the default input UI.

If you change the panel by setting the CurrentPanel property before the PenInputPanel object becomes active for the first time, a PanelChanged event occurs.

CurrentPanel returns the Inactive enumeration value if the panel window is associated with another instance of the PenInputPanel object. Setting the CurrentPanel property raises an exception if the panel is inactive or if the panel type is invalid.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example creates a PenInputPanel object, PenInputPanel, and attaches it to an InkEdit control, InkEdit1. It attaches a VisibleChanged event handler, thePenInputPanel_VisibleChanged to thePenInputPanel. The event handler method forces the pen input panel to display the keyboard panel whenever it becomes visible by setting the CurrentPanel property to PT_Keyboard.

' Declare a new PenInputPanel object
Dim WithEvents thePenInputPanel As PenInputPanel

Private Sub Form_Load()
  ' Create the PenInputPanel
  Set thePenInputPanel = New PenInputPanel

  ' Attach the PenInputPanel to an InkEdit control
  thePenInputPanel.AttachedEditWindow = InkEdit1.hWnd
End Sub

Private Sub thePenInputPanel_VisibleChanged(ByVal NewVisibility As Boolean)
  ' If the panel has become visible...
  If NewVisibility Then
    ' Always default to keyboard input
    If thePenInputPanel.CurrentPanel = PT_Handwriting Then
       thePenInputPanel.CurrentPanel = PT_Keyboard
    End If
  End If
End Sub

Applies To