openharmony 鸿蒙 capi-inputmethod-inputmethod-proxy-capi-h

2026-08-25 浏览 (1)

inputmethod_inputmethod_proxy_capi.h

Overview

Provides methods for using the input method, allowing requests and notifications to be sent to the input method application.

File to include: <inputmethod/inputmethod_inputmethod_proxy_capi.h>

Library: libohinputmethod.so

System capability: SystemCapability.MiscServices.InputMethodFramework

Since: 12

Related module: InputMethod

Summary

Structs

Nametypedef KeywordDescription
InputMethod_InputMethodProxyInputMethod_InputMethodProxyInput method proxy object, which can be used to call the method for using the input method.

Function

NameDescription
InputMethod_ErrorCode OH_InputMethodProxy_ShowKeyboard(InputMethod_InputMethodProxy *inputMethodProxy)Displays the keyboard.
InputMethod_ErrorCode OH_InputMethodProxy_ShowTextInput(InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_AttachOptions *options)Displays the text box.
InputMethod_ErrorCode OH_InputMethodProxy_HideKeyboard(InputMethod_InputMethodProxy *inputMethodProxy)Hides the keyboard.
InputMethod_ErrorCode OH_InputMethodProxy_NotifySelectionChange(InputMethod_InputMethodProxy *inputMethodProxy, char16_t text[], size_t length, int start, int end)Notifies the input method application of the change in the selected text area, including the change of text content, cursor position, or the selected text.
InputMethod_ErrorCode OH_InputMethodProxy_NotifyConfigurationChange(InputMethod_InputMethodProxy *inputMethodProxy,InputMethod_EnterKeyType enterKey, InputMethod_TextInputType textType)Notifies the change of the text box configuration.
InputMethod_ErrorCode OH_InputMethodProxy_NotifyCursorUpdate(InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_CursorInfo *cursorInfo)Notifies the change of the cursor position.
InputMethod_ErrorCode OH_InputMethodProxy_SendPrivateCommand(InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_PrivateCommand *privateCommand[], size_t size)Sends a private data command.

Function Description

OH_InputMethodProxy_ShowKeyboard()

InputMethod_ErrorCode OH_InputMethodProxy_ShowKeyboard(InputMethod_InputMethodProxy *inputMethodProxy)

Description

Displays the keyboard.

Since: 12

Parameters

NameDescription
InputMethod_InputMethodProxy *inputMethodProxyPointer to the InputMethod_InputMethodProxy instance obtained by calling OH_InputMethodController_Attach.

Returns

TypeDescription
InputMethod_ErrorCodeAn error code.
IME_ERR_OK - Success.
IME_ERR_IMCLIENT - Client error in input method.
IME_ERR_IMMS - Input method service error.
IME_ERR_DETACHED - Input method not bound.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_InputMethodProxy_ShowTextInput()

InputMethod_ErrorCode OH_InputMethodProxy_ShowTextInput(InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_AttachOptions *options)

Description

Displays the text box.

Since: 15

Parameters

NameDescription
InputMethod_InputMethodProxy *inputMethodProxyPointer to the InputMethod_InputMethodProxy instance obtained by calling OH_InputMethodController_Attach.
InputMethod_AttachOptions *optionsPointer to the InputMethod_AttachOptions instance, which is used to obtain the configuration options.
In this API, you only need to pay attention to InputMethod_RequestKeyboardReason, which indicates the reason for requesting the keyboard.

Returns

TypeDescription
InputMethod_ErrorCodeAn error code.
IME_ERR_OK - Success.
IME_ERR_IMCLIENT - Client error in input method.
IME_ERR_IMMS - Input method service error.
IME_ERR_DETACHED - Input method not bound.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_InputMethodProxy_HideKeyboard()

InputMethod_ErrorCode OH_InputMethodProxy_HideKeyboard(InputMethod_InputMethodProxy *inputMethodProxy)

Description

Hides the keyboard.

Since: 12

Parameters

NameDescription
InputMethod_InputMethodProxy *inputMethodProxyPointer to the InputMethod_InputMethodProxy instance obtained by calling OH_InputMethodController_Attach.

Returns

TypeDescription
InputMethod_ErrorCodeAn error code.
IME_ERR_OK - Success.
IME_ERR_IMCLIENT - Client error in input method.
IME_ERR_IMMS - Input method service error.
IME_ERR_DETACHED - Input method not bound.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_InputMethodProxy_NotifySelectionChange()

InputMethod_ErrorCode OH_InputMethodProxy_NotifySelectionChange(InputMethod_InputMethodProxy *inputMethodProxy, char16_t text[], size_t length, int start, int end)

Description

Notifies the input method application of the change in the selected text area, including the change of text content, cursor position, or the selected text.

Since: 12

Parameters

NameDescription
InputMethod_InputMethodProxy *inputMethodProxyPointer to the InputMethod_InputMethodProxy instance obtained by calling OH_InputMethodController_Attach.
textEntire input text.
size_t lengthLength of the text parameter. Maximum length: 8 KB.
int startStart position of the selected text.
int endEnd position of the selected text.

Returns

TypeDescription
InputMethod_ErrorCodeAn 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_DETACHED - Input method not bound.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_InputMethodProxy_NotifyConfigurationChange()

InputMethod_ErrorCode OH_InputMethodProxy_NotifyConfigurationChange(InputMethod_InputMethodProxy *inputMethodProxy,InputMethod_EnterKeyType enterKey, InputMethod_TextInputType textType)

Description

Notifies the change of the text box configuration.

Since: 12

Parameters

NameDescription
InputMethod_InputMethodProxy *inputMethodProxyPointer to the InputMethod_InputMethodProxy instance obtained by calling OH_InputMethodController_Attach.
InputMethod_EnterKeyType enterKeyEnter key type.
InputMethod_TextInputType textTypeText box type.

Returns

TypeDescription
InputMethod_ErrorCodeAn 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_DETACHED - Input method not bound.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_InputMethodProxy_NotifyCursorUpdate()

InputMethod_ErrorCode OH_InputMethodProxy_NotifyCursorUpdate(InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_CursorInfo *cursorInfo)

Description

Notifies the cursor position change.

Since: 12

Parameters

NameDescription
InputMethod_InputMethodProxy *inputMethodProxyPointer to the InputMethod_InputMethodProxy instance obtained by calling OH_InputMethodController_Attach.
InputMethod_CursorInfo *cursorInfoPointer to the InputMethod_CursorInfo instance, indicating the cursor information.

Returns

TypeDescription
InputMethod_ErrorCodeAn 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_DETACHED - Input method not bound.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_InputMethodProxy_SendPrivateCommand()

InputMethod_ErrorCode OH_InputMethodProxy_SendPrivateCommand(InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_PrivateCommand *privateCommand[], size_t size)

Description

Sends a private data command.

Since: 12

Parameters

NameDescription
InputMethod_InputMethodProxy *inputMethodProxyPointer to the InputMethod_InputMethodProxy instance obtained by calling OH_InputMethodController_Attach.
InputMethod_PrivateCommand *privateCommand[]Private command that is defined in InputMethod_PrivateCommand. The maximum size is 32 KB.
size_t sizeSize of the private command array. The maximum size is 5.

Returns

TypeDescription
InputMethod_ErrorCodeAn 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_DETACHED - Input method not bound.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-inputmethod-inputmethod-textconfig

openharmony 鸿蒙 js-apis-inputmethod-extension-context

openharmony 鸿蒙 js-apis-inputmethod-subtype

openharmony 鸿蒙 capi-inputmethod-text-editor-proxy-capi-h

openharmony 鸿蒙 capi-inputmethod-controller-capi-h

openharmony 鸿蒙 capi-inputmethod

openharmony 鸿蒙 js-apis-inputmethod-panel

openharmony 鸿蒙 js-apis-inputmethodengine

openharmony 鸿蒙 capi-inputmethod-cursor-info-capi-h

openharmony 鸿蒙 js-apis-inputmethod-system-panel-manager-sys

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/zMHZFltH