• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# inputmethod_text_config_capi.h
2<!--Kit: IME Kit-->
3<!--Subsystem: MiscServices-->
4<!--Owner: @illybyy-->
5<!--Designer: @andeszhang-->
6<!--Tester: @murphy1984-->
7<!--Adviser: @zhang_yixin13-->
8
9## 概述
10
11提供输入框配置信息对象的创建、销毁与读写方法。
12
13**引用文件:** <inputmethod/inputmethod_text_config_capi.h>
14
15**库:** libohinputmethod.so
16
17**系统能力:** SystemCapability.MiscServices.InputMethodFramework
18
19**起始版本:** 12
20
21**相关模块:** [InputMethod](capi-inputmethod.md)
22
23## 汇总
24
25### 结构体
26
27| 名称 | typedef关键字 | 描述 |
28| -- | -- | -- |
29| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) | InputMethod_TextConfig | 输入框配置。输入框的配置信息。 |
30
31### 函数
32
33| 名称 | 描述 |
34| -- | -- |
35| [InputMethod_TextConfig *OH_TextConfig_Create(void)](#oh_textconfig_create) | 创建一个新的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例。 |
36| [void OH_TextConfig_Destroy(InputMethod_TextConfig *config)](#oh_textconfig_destroy) | 销毁一个[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例。 |
37| [InputMethod_ErrorCode OH_TextConfig_SetInputType(InputMethod_TextConfig *config, InputMethod_TextInputType inputType)](#oh_textconfig_setinputtype) | 设置文本配置信息中的输入框类型。 |
38| [InputMethod_ErrorCode OH_TextConfig_SetEnterKeyType(InputMethod_TextConfig *config, InputMethod_EnterKeyType enterKeyType)](#oh_textconfig_setenterkeytype) | 设置文本配置信息中的回车键功能类型。 |
39| [InputMethod_ErrorCode OH_TextConfig_SetPreviewTextSupport(InputMethod_TextConfig *config, bool supported)](#oh_textconfig_setpreviewtextsupport) | 将预上屏支持情况设置到文本配置信息中。 |
40| [InputMethod_ErrorCode OH_TextConfig_SetSelection(InputMethod_TextConfig *config, int32_t start, int32_t end)](#oh_textconfig_setselection) | 设置文本配置信息中的选中文本范围。 |
41| [InputMethod_ErrorCode OH_TextConfig_SetWindowId(InputMethod_TextConfig *config, int32_t windowId)](#oh_textconfig_setwindowid) | 设置文本配置信息中所属窗口的窗口id。 |
42| [InputMethod_ErrorCode OH_TextConfig_SetPlaceholder(InputMethod_TextConfig *config, const char16_t *placeholder,size_t length)](#oh_textconfig_setplaceholder) | 设置文本配置信息中的占位符文本信息。 |
43| [InputMethod_ErrorCode OH_TextConfig_SetAbilityName(InputMethod_TextConfig *config, const char16_t *abilityName,size_t length)](#oh_textconfig_setabilityname) | 设置文本配置信息中的abilityName信息。 |
44| [InputMethod_ErrorCode OH_TextConfig_GetInputType(InputMethod_TextConfig *config, InputMethod_TextInputType *inputType)](#oh_textconfig_getinputtype) | 获取文本配置信息中的输入框类型。 |
45| [InputMethod_ErrorCode OH_TextConfig_GetEnterKeyType(InputMethod_TextConfig *config, InputMethod_EnterKeyType *enterKeyType)](#oh_textconfig_getenterkeytype) | 获取文本配置信息中的回车键功能类型。 |
46| [InputMethod_ErrorCode OH_TextConfig_IsPreviewTextSupported(InputMethod_TextConfig *config, bool *supported)](#oh_textconfig_ispreviewtextsupported) | 获取文本配置中是否支持预上屏。 |
47| [InputMethod_ErrorCode OH_TextConfig_GetCursorInfo(InputMethod_TextConfig *config, InputMethod_CursorInfo **cursorInfo)](#oh_textconfig_getcursorinfo) | 获取文本配置信息中的光标信息。 |
48| [InputMethod_ErrorCode OH_TextConfig_GetTextAvoidInfo(InputMethod_TextConfig *config, InputMethod_TextAvoidInfo **avoidInfo)](#oh_textconfig_gettextavoidinfo) | 获取文本配置信息中的避让信息。 |
49| [InputMethod_ErrorCode OH_TextConfig_GetSelection(InputMethod_TextConfig *config, int32_t *start, int32_t *end)](#oh_textconfig_getselection) | 获取文本配置信息中的选区范围信息。 |
50| [InputMethod_ErrorCode OH_TextConfig_GetWindowId(InputMethod_TextConfig *config, int32_t *windowId)](#oh_textconfig_getwindowid) | 获取文本配置信息中所属窗口的窗口id。 |
51| [InputMethod_ErrorCode OH_TextConfig_GetPlaceholder(InputMethod_TextConfig *config, char16_t *placeholder,size_t *length)](#oh_textconfig_getplaceholder) | 获取文本配置信息中的占位符文本信息。 |
52| [InputMethod_ErrorCode OH_TextConfig_GetAbilityName(InputMethod_TextConfig *config, char16_t *abilityName,size_t *length)](#oh_textconfig_getabilityname) | 获取文本配置信息中的abilityName信息。 |
53
54## 函数说明
55
56### OH_TextConfig_Create()
57
58```
59InputMethod_TextConfig *OH_TextConfig_Create(void)
60```
61
62**描述**
63
64创建一个新的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例。
65
66**起始版本:** 12
67
68**返回:**
69
70| 类型 | 说明 |
71| -- | -- |
72| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) * | 如果创建成功,返回一个指向新创建的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。<br> 如果创建失败,对象返回NULL,可能的失败原因有应用地址空间满。 |
73
74### OH_TextConfig_Destroy()
75
76```
77void OH_TextConfig_Destroy(InputMethod_TextConfig *config)
78```
79
80**描述**
81
82销毁一个[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例。
83
84**起始版本:** 12
85
86
87**参数:**
88
89| 参数项 | 描述 |
90| -- | -- |
91| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 表示指向即将被销毁的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。 |
92
93### OH_TextConfig_SetInputType()
94
95```
96InputMethod_ErrorCode OH_TextConfig_SetInputType(InputMethod_TextConfig *config, InputMethod_TextInputType inputType)
97```
98
99**描述**
100
101设置文本配置信息中的输入框类型。
102
103**起始版本:** 12
104
105
106**参数:**
107
108| 参数项 | 描述 |
109| -- | -- |
110| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 指向即将被设置值的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。 |
111| [InputMethod_TextInputType](capi-inputmethod-types-capi-h.md#inputmethod_textinputtype) inputType | 输入框的输入类型。 |
112
113**返回:**
114
115| 类型 | 说明 |
116| -- | -- |
117| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | 返回一个特定的错误码。<br>     [IME_ERR_OK](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 表示成功。<br>     [IME_ERR_NULL_POINTER](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 非预期的空指针。<br> 具体错误码可以参考[InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode)。 |
118
119### OH_TextConfig_SetEnterKeyType()
120
121```
122InputMethod_ErrorCode OH_TextConfig_SetEnterKeyType(InputMethod_TextConfig *config, InputMethod_EnterKeyType enterKeyType)
123```
124
125**描述**
126
127设置文本配置信息中的回车键功能类型。
128
129**起始版本:** 12
130
131
132**参数:**
133
134| 参数项 | 描述 |
135| -- | -- |
136| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 指向即将被设置值的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。 |
137| [InputMethod_EnterKeyType](capi-inputmethod-types-capi-h.md#inputmethod_enterkeytype) enterKeyType | 回车键功能类型。 |
138
139**返回:**
140
141| 类型 | 说明 |
142| -- | -- |
143| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | 返回一个特定的错误码。<br>     [IME_ERR_OK](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 表示成功。<br>     [IME_ERR_NULL_POINTER](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 非预期的空指针。<br> 具体错误码可以参考[InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode)。 |
144
145### OH_TextConfig_SetPreviewTextSupport()
146
147```
148InputMethod_ErrorCode OH_TextConfig_SetPreviewTextSupport(InputMethod_TextConfig *config, bool supported)
149```
150
151**描述**
152
153将预上屏支持情况设置到文本配置信息中。
154
155**起始版本:** 12
156
157
158**参数:**
159
160| 参数项 | 描述 |
161| -- | -- |
162| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 指向即将被设置值的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。 |
163| bool supported | 表示输入框是否支持预上屏。 |
164
165**返回:**
166
167| 类型 | 说明 |
168| -- | -- |
169| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | 返回一个特定的错误码。<br>     [IME_ERR_OK](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 表示成功。<br>     [IME_ERR_NULL_POINTER](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 非预期的空指针。<br> 具体错误码可以参考[InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode)。 |
170
171### OH_TextConfig_SetSelection()
172
173```
174InputMethod_ErrorCode OH_TextConfig_SetSelection(InputMethod_TextConfig *config, int32_t start, int32_t end)
175```
176
177**描述**
178
179设置文本配置信息中的选中文本范围。
180
181**起始版本:** 12
182
183
184**参数:**
185
186| 参数项 | 描述 |
187| -- | -- |
188| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 指向即将被设置值的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。 |
189| int32_t start | 所选文本的起始位置。 |
190| int32_t end | 所选文本的结束位置。 |
191
192**返回:**
193
194| 类型 | 说明 |
195| -- | -- |
196| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | 返回一个特定的错误码。<br>     [IME_ERR_OK](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 表示成功。<br>     [IME_ERR_NULL_POINTER](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 非预期的空指针。<br> 具体错误码可以参考[InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode)。 |
197
198### OH_TextConfig_SetWindowId()
199
200```
201InputMethod_ErrorCode OH_TextConfig_SetWindowId(InputMethod_TextConfig *config, int32_t windowId)
202```
203
204**描述**
205
206设置文本配置信息中所属窗口的窗口id。
207
208**起始版本:** 12
209
210
211**参数:**
212
213| 参数项 | 描述 |
214| -- | -- |
215| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 指向即将被设置值的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。 |
216| int32_t windowId | 绑定输入法的应用所属窗口的窗口id。 |
217
218**返回:**
219
220| 类型 | 说明 |
221| -- | -- |
222| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | 返回一个特定的错误码。<br>     [IME_ERR_OK](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 表示成功。<br>     [IME_ERR_NULL_POINTER](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 非预期的空指针。<br> 具体错误码可以参考[InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode)。 |
223
224### OH_TextConfig_SetPlaceholder()
225
226```
227InputMethod_ErrorCode OH_TextConfig_SetPlaceholder(InputMethod_TextConfig *config, const char16_t *placeholder,size_t length)
228```
229
230**描述**
231
232设置文本配置信息中的占位符文本信息。
233
234**起始版本:** 20
235
236
237**参数:**
238
239| 参数项 | 描述 |
240| -- | -- |
241| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 指向即将被设置值的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。 |
242| const char16_t *placeholder | 指向UTF-16编码的双字节指针;若传空指针,则会将占位文本信息设置为空字符串。 |
243| size_t length | placeholder指针指向内存所包含的元素个数,包含最后的字符串结尾符,计数单位为双字节。1. 如果长度为0,占位文本信息会被设置为空字符串。2. UTF-16编码的最大长度为255个字符(如果最后一位是字符串结尾符,不包含在计数中),超过255个字符数将会被截断。 |
244
245**返回:**
246
247| 类型 | 说明 |
248| -- | -- |
249| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode):<br>     IME_ERR_OK = 0:表示成功。<br>     IME_ERR_NULL_POINTER = 12802000:非预期的空指针。 |
250
251### OH_TextConfig_SetAbilityName()
252
253```
254InputMethod_ErrorCode OH_TextConfig_SetAbilityName(InputMethod_TextConfig *config, const char16_t *abilityName,size_t length)
255```
256
257**描述**
258
259设置文本配置信息中的abilityName信息。
260
261**起始版本:** 20
262
263
264**参数:**
265
266| 参数项 | 描述 |
267| -- | -- |
268| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 指向即将被设置值的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。 |
269| const char16_t *abilityName | 指向UTF-16编码的双字节指针;若传空指针,则会将abilityName设置为空字符串。 |
270| size_t length | abilityName指针指向内存所包含的元素个数,包含最后的字符串结尾符,计数单位为双字节。1. 如果长度为0,abilityName会被设置为空字符串。2. UTF-16编码的最大长度为127个字符(如果最后一位是字符串结尾符,不包含在计数中),超过127个字符数将会被截断。 |
271
272**返回:**
273
274| 类型 | 说明 |
275| -- | -- |
276| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode):<br>     IME_ERR_OK = 0:表示成功。<br>     IME_ERR_NULL_POINTER = 12802000:非预期的空指针。 |
277
278### OH_TextConfig_GetInputType()
279
280```
281InputMethod_ErrorCode OH_TextConfig_GetInputType(InputMethod_TextConfig *config, InputMethod_TextInputType *inputType)
282```
283
284**描述**
285
286获文本配置信息中的输入框类型。
287
288**起始版本:** 12
289
290
291**参数:**
292
293| 参数项 | 描述 |
294| -- | -- |
295| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 指向即将被获取值的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。 |
296| [InputMethod_TextInputType](capi-inputmethod-types-capi-h.md#inputmethod_textinputtype) *inputType | 表示指向[InputMethod_TextInputType](capi-inputmethod-types-capi-h.md#inputmethod_textinputtype)实例的指针。 输入框的输入类型。 |
297
298**返回:**
299
300| 类型 | 说明 |
301| -- | -- |
302| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | 返回一个特定的错误码。<br>     [IME_ERR_OK](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 表示成功。<br>     [IME_ERR_NULL_POINTER](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 非预期的空指针。<br> 具体错误码可以参考[InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode)。 |
303
304### OH_TextConfig_GetEnterKeyType()
305
306```
307InputMethod_ErrorCode OH_TextConfig_GetEnterKeyType(InputMethod_TextConfig *config, InputMethod_EnterKeyType *enterKeyType)
308```
309
310**描述**
311
312获取文本配置信息中的回车键功能类型。
313
314**起始版本:** 12
315
316
317**参数:**
318
319| 参数项 | 描述 |
320| -- | -- |
321| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 指向即将被获取值的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。 |
322| [InputMethod_EnterKeyType](capi-inputmethod-types-capi-h.md#inputmethod_enterkeytype) *enterKeyType | 表示指向[InputMethod_EnterKeyType](capi-inputmethod-types-capi-h.md#inputmethod_enterkeytype)实例的指针。 输入框的回车键功能类型。 |
323
324**返回:**
325
326| 类型 | 说明 |
327| -- | -- |
328| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | 返回一个特定的错误码。<br>     [IME_ERR_OK](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 表示成功。<br>     [IME_ERR_NULL_POINTER](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 非预期的空指针。<br> 具体错误码可以参考[InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode)。 |
329
330### OH_TextConfig_IsPreviewTextSupported()
331
332```
333InputMethod_ErrorCode OH_TextConfig_IsPreviewTextSupported(InputMethod_TextConfig *config, bool *supported)
334```
335
336**描述**
337
338获取文本配置中是否支持预上屏。
339
340**起始版本:** 12
341
342
343**参数:**
344
345| 参数项 | 描述 |
346| -- | -- |
347| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 指向即将被获取值的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。 |
348| bool *supported | 表示输入框是否支持预上屏。 |
349
350**返回:**
351
352| 类型 | 说明 |
353| -- | -- |
354| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | 返回一个特定的错误码。<br>     [IME_ERR_OK](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 表示成功。<br>     [IME_ERR_NULL_POINTER](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 非预期的空指针。<br> 具体错误码可以参考[InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode)。 |
355
356### OH_TextConfig_GetCursorInfo()
357
358```
359InputMethod_ErrorCode OH_TextConfig_GetCursorInfo(InputMethod_TextConfig *config, InputMethod_CursorInfo **cursorInfo)
360```
361
362**描述**
363
364获取文本配置信息中的光标信息。
365
366**起始版本:** 12
367
368
369**参数:**
370
371| 参数项                                                                          | 描述 |
372|------------------------------------------------------------------------------| -- |
373| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 指向即将被获取值的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。 |
374| [InputMethod_CursorInfo](capi-inputmethod-inputmethod-cursorinfo.md) **cursorInfo                                      | 光标信息。 |
375
376**返回:**
377
378| 类型 | 说明 |
379| -- | -- |
380| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | 返回一个特定的错误码。<br>     [IME_ERR_OK](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 表示成功。<br>     [IME_ERR_NULL_POINTER](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 非预期的空指针。<br> 具体错误码可以参考[InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode)。 |
381
382### OH_TextConfig_GetTextAvoidInfo()
383
384```
385InputMethod_ErrorCode OH_TextConfig_GetTextAvoidInfo(InputMethod_TextConfig *config, InputMethod_TextAvoidInfo **avoidInfo)
386```
387
388**描述**
389
390获取文本配置信息中的避让信息。
391
392**起始版本:** 12
393
394
395**参数:**
396
397| 参数项                                                                          | 描述 |
398|------------------------------------------------------------------------------| -- |
399| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 表示文本配置信息。 |
400| [InputMethod_TextAvoidInfo](capi-inputmethod-inputmethod-textavoidinfo.md) **avoidInfo                                    | 输入框避让信息。 |
401
402**返回:**
403
404| 类型 | 说明 |
405| -- | -- |
406| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | 返回一个特定的错误码。<br>     [IME_ERR_OK](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 表示成功。<br>     [IME_ERR_NULL_POINTER](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 非预期的空指针。<br> 具体错误码可以参考[InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode)。<br> |
407
408### OH_TextConfig_GetSelection()
409
410```
411InputMethod_ErrorCode OH_TextConfig_GetSelection(InputMethod_TextConfig *config, int32_t *start, int32_t *end)
412```
413
414**描述**
415
416获取文本配置信息中的选区范围信息。
417
418**起始版本:** 12
419
420
421**参数:**
422
423| 参数项 | 描述 |
424| -- | -- |
425| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 指向即将被获取值的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。 |
426| int32_t *start | 所选文本的起始位置。 |
427| int32_t *end | 所选文本的结束位置。 |
428
429**返回:**
430
431| 类型 | 说明 |
432| -- | -- |
433| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | 返回一个特定的错误码。<br>     [IME_ERR_OK](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 表示成功。<br>     [IME_ERR_NULL_POINTER](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 非预期的空指针。<br> 具体错误码可以参考[InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode)。 |
434
435### OH_TextConfig_GetWindowId()
436
437```
438InputMethod_ErrorCode OH_TextConfig_GetWindowId(InputMethod_TextConfig *config, int32_t *windowId)
439```
440
441**描述**
442
443获取文本配置信息中所属窗口的窗口id。
444
445**起始版本:** 12
446
447
448**参数:**
449
450| 参数项 | 描述 |
451| -- | -- |
452| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 指向即将被获取值的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。 |
453| int32_t *windowId | 绑定输入法的应用所属窗口的窗口id。 |
454
455**返回:**
456
457| 类型 | 说明 |
458| -- | -- |
459| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | 返回一个特定的错误码。<br>     [IME_ERR_OK](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 表示成功。<br>     [IME_ERR_NULL_POINTER](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) - 非预期的空指针。<br> 具体错误码可以参考[InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode)。 |
460
461### OH_TextConfig_GetPlaceholder()
462
463```
464InputMethod_ErrorCode OH_TextConfig_GetPlaceholder(InputMethod_TextConfig *config, char16_t *placeholder,size_t *length)
465```
466
467**描述**
468
469获取文本配置信息中的占位符文本信息。
470
471**起始版本:** 20
472
473
474**参数:**
475
476| 参数项 | 描述 |
477| -- | -- |
478| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 指向即将被获取值的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。 |
479| char16_t *placeholder | 用于存放占位文本信息,该指针内存由调用者维护。 |
480| size_t *length | 占位文本信息长度,计数单位为双字节,长度包含字符串结尾符。1. 作为入参,代表placeholder指向的内存可用长度。作为出参,代表实际的占位文本长度。2. 如果placeholder为空指针,且length指向有效内存,则length会被填充实际的占位文本长度。接口会返错。3. 如果placeholder和length都指向有效内存,但length传入的长度小于实际的占位文本长度,则length会被填充实际的占位文本长度。接口会返错。 |
481
482**返回:**
483
484| 类型 | 说明 |
485| -- | -- |
486| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode):<br>     IME_ERR_OK = 0:表示成功。<br>     IME_ERR_PARAMCHECK = 401:参数检查失败。<br>     IME_ERR_NULL_POINTER = 12802000:非预期的空指针。 |
487
488### OH_TextConfig_GetAbilityName()
489
490```
491InputMethod_ErrorCode OH_TextConfig_GetAbilityName(InputMethod_TextConfig *config, char16_t *abilityName,size_t *length)
492```
493
494**描述**
495
496获取文本配置信息中的abilityName信息。
497
498**起始版本:** 20
499
500
501**参数:**
502
503| 参数项 | 描述 |
504| -- | -- |
505| [InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md) *config | 指向即将被获取值的[InputMethod_TextConfig](capi-inputmethod-inputmethod-textconfig.md)实例的指针。 |
506| char16_t *abilityName | 用于存放abilityName,该指针内存由调用者维护。 |
507| size_t *length | abilityName长度,计数单位为双字节,长度包含字符串结尾符。1. 作为入参,代表abilityName指向的内存可用长度。作为出参,代表实际的abilityName长度。2. 如果abilityName为空指针,且length指向有效内存,则length会被填充实际的abilityName长度。接口会返错。3. 如果abilityName和length都指向有效内存,但length传入的长度小于实际的abilityName长度,则length会被填充实际的占位文本长度。接口会返错。 |
508
509**返回:**
510
511| 类型 | 说明 |
512| -- | -- |
513| [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode) | [InputMethod_ErrorCode](capi-inputmethod-types-capi-h.md#inputmethod_errorcode):<br>     IME_ERR_OK = 0:表示成功。<br>     IME_ERR_PARAMCHECK = 401:参数检查失败。<br>     IME_ERR_NULL_POINTER = 12802000:非预期的空指针。 |
514
515
516