Partager via


EnableTsf Method

EnableTsf Method

Gets or sets a Boolean value that indicates whether or not the PenInputPanel object attempts to send text to the attached control through the Text Services Framework Leave Site (TSF) and enables the use of the correction user interface.

Declaration

[C++]

HRESULT EnableTsf (
    [in] bool Enable
);

[Microsoft® Visual Basic® 6.0]

Public Sub EnableTsf ( _
    Enable as Boolean _
)

Parameters

Enable

[in] A Boolean variable that indicates if the PenInputPanel object should attempt to send text to the attached control using Text Services Framework (TSF) and that the correction user interface should be enabled. If Text Services Framework (TSF) should be used TRUE; otherwise FALSE. The default value is TRUE.

Return Value

HRESULT value Description
S_OK Success.
E_UNEXPECTED Unexpected parameter or property type.
E_NOINTERFACE TSF interfaces are not exposed on the attached control.
E_FAIL An unspecified error occurred.

Remarks

Calling this method with Enable set to TRUE causes the PenInputPanel object to attempt to start the TSF on the attached control.

Note: Support has been added to TSF and Microsoft Windows® to provide a consistent user interface for all applications across the desktop. This new support enables legacy applications or controls that are not aware of TSF to take advantage of some advanced text services for free. For example, speech dictation and handwriting can now be used to enter text into a document in any application.

This new feature is available and enabled by default on Windows XP Tablet PC Edition. To enable or disable it:

  1. In Control Panel, click Regional and Language Options.
  2. On the Languages tab, click Details.
  3. On the Advanced tab of the Text Services and Input Languages dialog box, select or clear Extend support of advanced text services to all programs.

If successful, text is sent to the attached control through TSF. Furthermore, if the control supports TSF (and is not simply receiving text from TSF just because Advanced Text Services has been enabled for all programs in Control Panel as noted above), then the correction user interface appears in the control and allows access to handwriting alternates. Calling this method with Enable set to FALSE causes the PenInputPanel object to attempt to shut down TSF on the attached control.

EnableTsf should be used to enable the PenInputPanel to use the TSF insertion context rather than SendInput Function Leave Site to send the handwriting recognition results into the control. The result is that text can be inserted even if the field no longer has focus.

When you call EnableTsf with a value of TRUE, the PenInputPanel object sends an EM_SETEDITSTYLE Leave Site message to the attached control. If the control does not support this message, results may be unpredictable. The InkEdit control does support TSF.

Examples

[Visual Basic 6.0]

This Visual Basic 6.0 example creates a PenInputPanel object, thePenInputPanel, and attaches it to an InkEdit control, InkEdit1. The EnableTsf method is called on the PenInputPanel to start TSF.

'Declare a new PenInputPanel object
Dim thePenInputPanel As PenInputPanel

'Create the PenInputPanel
Set thePenInputPanel = New PenInputPanel

'Attach the PenInputPanel to an InkEdit control
thePenInputPanel.AttachedEditWindow = InkEdit1.hwnd

'Start the Text Services Framework
thePenInputPanel.EnableTsf True

Applies To