inputmethod_controller_capi.h

Overview

Provides methods for binding and unbinding input methods.

File to include: <inputmethod/inputmethod_controller_capi.h>

Library: libohinputmethod.so

System capability: SystemCapability.MiscServices.InputMethodFramework

Since: 12

Related module: InputMethod

Summary

Function

Name Description
InputMethod_ErrorCode OH_InputMethodController_Attach(InputMethod_TextEditorProxy *textEditorProxy,InputMethod_AttachOptions *options, InputMethod_InputMethodProxy **inputMethodProxy) Binds an application to the input method service.
InputMethod_ErrorCode OH_InputMethodController_AttachWithUIContext(ArkUI_ContextHandle context, InputMethod_TextEditorProxy *textEditorProxy, InputMethod_AttachOptions *options, InputMethod_InputMethodProxy **inputMethodProxy) Binds an application to the input method service.
InputMethod_ErrorCode OH_InputMethodController_Detach(InputMethod_InputMethodProxy *inputMethodProxy) Unbinds an application from the input method service.

Function Description

OH_InputMethodController_Attach()

InputMethod_ErrorCode OH_InputMethodController_Attach(InputMethod_TextEditorProxy *textEditorProxy,InputMethod_AttachOptions *options, InputMethod_InputMethodProxy **inputMethodProxy)

Description

Binds an application to the input method service.

Since: 12

Parameters

Name Description
InputMethod_TextEditorProxy *textEditorProxy Pointer to the InputMethod_TextEditorProxy instance. The caller needs to manage the textEditorProxy lifecycle. If the calling is successful, the caller cannot release textEditorProxy before the next binding or unbinding call.
InputMethod_AttachOptions *options Pointer to the InputMethod_AttachOptions instance. This parameter is used to specify the options of attaching an input method.
InputMethod_InputMethodProxy **inputMethodProxy Double pointer to the InputMethod_InputMethodProxy instance. The lifecycle lasts until the next binding or unbinding call.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_PARAMCHECK - Parameter error.
IME_ERR_IMCLIENT - Client error in input method.
IME_ERR_IMMS - Input method service error.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_InputMethodController_AttachWithUIContext()

InputMethod_ErrorCode OH_InputMethodController_AttachWithUIContext(ArkUI_ContextHandle context, InputMethod_TextEditorProxy *textEditorProxy, InputMethod_AttachOptions *options, InputMethod_InputMethodProxy **inputMethodProxy)

Description

Binds an application to the input method service.

Since: 23

Parameters

Name Description
ArkUI_ContextHandle context Pointer to the ArkUI_Context instance.
InputMethod_TextEditorProxy *textEditorProxy Pointer to the InputMethod_TextEditorProxy instance. The caller needs to manage the textEditorProxy lifecycle. If the calling is successful, the caller cannot release textEditorProxy before the next binding or unbinding call.
InputMethod_AttachOptions *options Pointer to the InputMethod_AttachOptions instance. This parameter is used to specify the options of attaching an input method.
InputMethod_InputMethodProxy **inputMethodProxy Double pointer to the InputMethod_InputMethodProxy instance. The lifecycle lasts until the next binding or unbinding call.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_PARAMCHECK - Parameter error.
IME_ERR_IMCLIENT - Client error in input method.
IME_ERR_IMMS - Input method service error.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_InputMethodController_Detach()

InputMethod_ErrorCode OH_InputMethodController_Detach(InputMethod_InputMethodProxy *inputMethodProxy)

Description

Unbinds an application from the input method service.

Since: 12

Parameters

Name Description
InputMethod_InputMethodProxy *inputMethodProxy Pointer to the InputMethod_InputMethodProxy instance obtained by calling OH_InputMethodController_Attach.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_IMCLIENT - Client error in input method.
IME_ERR_IMMS - Input method service error.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.