# @ohos.multimodalInput.pointer (鼠标指针)(系统接口)
鼠标指针管理模块,用于查询和设置鼠标指针相关属性。
> **说明**:
>
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
>
> 当前页面仅包含本模块的系统接口,其他公开接口参见[@ohos.multimodalInput.pointer (鼠标指针)](js-apis-pointer.md)。
## 导入模块
```js
import { pointer } from '@kit.InputKit';
```
## pointer.setPointerSpeed
setPointerSpeed(speed: number, callback: AsyncCallback<void>): void
设置鼠标移动速度,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------- |
| speed | number | 是 | 鼠标移动速度,范围1-11,默认为7。 |
| callback | AsyncCallback<void> | 是 | 回调函数。 |
**错误码:**
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| -------- | ----------------- |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.2.Incorrect parameter types.3.Parameter verification failed. |
**示例**:
```js
try {
pointer.setPointerSpeed(5, (error: Error) => {
if (error) {
console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Set pointer speed success`);
});
} catch (error) {
console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setPointerSpeed
setPointerSpeed(speed: number): Promise<void>
设置鼠标移动速度,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| speed | number | 是 | 鼠标移动速度,范围1-11,默认为7。 |
**返回值**:
| 参数 | 说明 |
| ------------------- | ---------------- |
| Promise<void> | Promise对象。 |
**错误码:**
以下错误码的详细介绍请参见[ohos.devicestatus错误码](../apis-distributedservice-kit/errorcode-devicestatus.md)。
| 错误码ID | 错误信息 |
| -------- | ----------------- |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.2.Incorrect parameter types.3.Parameter verification failed. |
**示例**:
```js
try {
pointer.setPointerSpeed(5).then(() => {
console.log(`Set pointer speed success`);
});
} catch (error) {
console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setPointerSpeedSync10+
setPointerSpeedSync(speed: number): void
使用同步方式设置鼠标移动速度。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| speed | number | 是 | 鼠标移动速度,范围1-11,默认为7。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
let speed = pointer.setPointerSpeedSync(5);
console.log(`Set pointer speed success`);
} catch (error) {
console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getPointerSpeed
getPointerSpeed(callback: AsyncCallback<number>): void
获取鼠标移动速度,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback<number> | 是 | 回调函数,异步返回鼠标移动速度。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getPointerSpeed((error: Error, speed: number) => {
if (error) {
console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`);
});
} catch (error) {
console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getPointerSpeed
getPointerSpeed(): Promise<number>
获取当前鼠标移动速度,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| Promise<number> | Promise实例,异步返回鼠标移动速度。 |
**示例**:
```js
try {
pointer.getPointerSpeed().then(speed => {
console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`);
});
} catch (error) {
console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getPointerSpeedSync10+
getPointerSpeedSync(): number
使用同步方式获取当前鼠标移动速度。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| number | 返回鼠标移动速度。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
let speed = pointer.getPointerSpeedSync();
console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`);
} catch (error) {
console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setHoverScrollState10+
setHoverScrollState(state: boolean, callback: AsyncCallback<void>): void
设置鼠标悬停滚动开关状态,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------- |
| state | boolean | 是 | 鼠标悬停滚动开关状态。true代表开关开启,false代表开关关闭,默认开启。 |
| callback | AsyncCallback<void> | 是 | 回调函数。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setHoverScrollState(true, (error: Error) => {
if (error) {
console.log(`Set the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Set the mouse hover scroll success`);
});
} catch (error) {
console.log(`Set the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setHoverScrollState10+
setHoverScrollState(state: boolean): Promise<void>
设置鼠标悬停滚动开关状态,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| state | boolean | 是 | 鼠标悬停滚动开关状态。true代表开关开启,false代表开关关闭,默认开启。 |
**返回值**:
| 参数 | 说明 |
| ------------------- | ---------------- |
| Promise<void> | Promise对象。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setHoverScrollState(true).then(() => {
console.log(`Set the mouse hover scroll success`);
});
} catch (error) {
console.log(`Set the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getHoverScrollState10+
getHoverScrollState(callback: AsyncCallback<boolean>): void
获取鼠标悬停滚动开关状态,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback<boolean> | 是 | 回调函数,异步返回鼠标悬停滚动开关状态。true代表开关开启,false代表开关关闭,默认开启。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getHoverScrollState((error: Error, state: boolean) => {
console.log(`Get the mouse hover scroll success, state: ${JSON.stringify(state)}`);
});
} catch (error) {
console.log(`Get the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getHoverScrollState10+
getHoverScrollState(): Promise<boolean>
获取当前鼠标悬停滚动开关状态,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| Promise<boolean> | Promise实例,异步返回鼠标悬停滚动开关状态。true代表开关开启,false代表开关关闭,默认开启。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getHoverScrollState().then((state: boolean) => {
console.log(`Get the mouse hover scroll success, state: ${JSON.stringify(state)}`);
});
} catch (error) {
console.log(`Get the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setMousePrimaryButton10+
setMousePrimaryButton(primary: PrimaryButton, callback: AsyncCallback<void>): void
设置鼠标主键,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------- |
| primary | [PrimaryButton](js-apis-pointer.md#primarybutton10) | 是 | 鼠标主键id。 |
| callback | AsyncCallback<void> | 是 | 回调函数。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setMousePrimaryButton(pointer.PrimaryButton.RIGHT, (error: Error) => {
if (error) {
console.log(`Set mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Set mouse primary button success`);
});
} catch (error) {
console.log(`Set mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setMousePrimaryButton10+
setMousePrimaryButton(primary: PrimaryButton): Promise<void>
设置鼠标主键,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| primary | [PrimaryButton](js-apis-pointer.md#primarybutton10) | 是 | 鼠标主键id。 |
**返回值**:
| 参数 | 说明 |
| ------------------- | ---------------- |
| Promise<void> | Promise对象。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setMousePrimaryButton(pointer.PrimaryButton.RIGHT).then(() => {
console.log(`Set mouse primary button success`);
});
} catch (error) {
console.log(`Set mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getMousePrimaryButton10+
getMousePrimaryButton(callback: AsyncCallback<PrimaryButton>): void
获取当前鼠标主键,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback<[PrimaryButton](js-apis-pointer.md#primarybutton10)> | 是 | 回调函数,异步返回鼠标主键。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getMousePrimaryButton((error: Error, primary: pointer.PrimaryButton) => {
console.log(`Get mouse primary button success, primary: ${JSON.stringify(primary)}`);
});
} catch (error) {
console.log(`Get mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getMousePrimaryButton10+
getMousePrimaryButton(): Promise<PrimaryButton>
获取当前鼠标主键,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| Promise<[PrimaryButton](js-apis-pointer.md#primarybutton10)> | Promise实例,异步返回鼠标主键。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getMousePrimaryButton().then((primary: pointer.PrimaryButton) => {
console.log(`Get mouse primary button success, primary: ${JSON.stringify(primary)}`);
});
} catch (error) {
console.log(`Get mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setMouseScrollRows10+
setMouseScrollRows(rows: number, callback: AsyncCallback<void>): void
设置鼠标滚动行数,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------- |
| rows | number | 是 | 鼠标滚动行数,范围1-100,默认为3。 |
| callback | AsyncCallback<void> | 是 | 回调函数。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setMouseScrollRows(1, (error: Error) => {
if (error) {
console.log(`setMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`setMouseScrollRows success`);
});
} catch (error) {
console.log(`setMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setMouseScrollRows10+
setMouseScrollRows(rows: number): Promise<void>
设置鼠标滚动行数,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| rows | number | 是 | 鼠标滚动行数,范围1-100,默认为3。 |
**返回值**:
| 参数 | 说明 |
| ------------------- | ---------------- |
| Promise<void> | Promise对象。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setMouseScrollRows(20).then(() => {
console.log(`setMouseScrollRows success`);
});
} catch (error) {
console.log(`setMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getMouseScrollRows10+
getMouseScrollRows(callback: AsyncCallback<number>): void
获取鼠标滚动行数,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback<number> | 是 | 回调函数,异步返回鼠标滚动行数。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getMouseScrollRows((error: Error, rows: number) => {
console.log(`getMouseScrollRows success, rows: ${JSON.stringify(rows)}`);
});
} catch (error) {
console.log(`getMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getMouseScrollRows10+
getMouseScrollRows(): Promise<number>
获取当前鼠标滚动行数,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| Promise<number> | Promise实例,异步返回鼠标滚动行数。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getMouseScrollRows().then((rows: number) => {
console.log(`getMouseScrollRows success, rows: ${JSON.stringify(rows)}`);
});
} catch (error) {
console.log(`getMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setTouchpadScrollSwitch10+
setTouchpadScrollSwitch(state: boolean, callback: AsyncCallback\): void
设置触控板滚轴开关,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------- |
| state | boolean | 是 | 滚轴开关开启的状态,true代表开启,false代表关闭,默认为开启 |
| callback | AsyncCallback\ | 是 | 回调函数。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setTouchpadScrollSwitch(true, (error: Error) => {
if (error) {
console.log(`setTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`setTouchpadScrollSwitch success`);
});
} catch (error) {
console.log(`setTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setTouchpadScrollSwitch10+
setTouchpadScrollSwitch(state: boolean): Promise\
设置触控板滚轴开关,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| state | boolean| 是 | 滚轴开关开启的状态,true代表开启,false代表关闭,默认为开启 |
**返回值**:
| 参数 | 说明 |
| ------------------- | ---------------- |
| Promise\ | Promise对象。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setTouchpadScrollSwitch(false).then(() => {
console.log(`setTouchpadScrollSwitch success`);
});
} catch (error) {
console.log(`setTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getTouchpadScrollSwitch10+
getTouchpadScrollSwitch(callback: AsyncCallback\): void
获取触控板滚轴能力开启状态,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\ | 是 | 回调函数,异步返回触控板滚轴能力开启状态。true代表开启,false代表关闭,默认为开启。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getTouchpadScrollSwitch((error: Error, state: boolean) => {
console.log(`getTouchpadScrollSwitch success, state: ${JSON.stringify(state)}`);
});
} catch (error) {
console.log(`getTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getTouchpadScrollSwitch10+
getTouchpadScrollSwitch(): Promise\
获取触控板滚轴能力开启状态,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| Promise\ | Promise实例,异步返回触控板滚轴能力开启状态。true代表开启,false代表关闭,默认为开启。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getTouchpadScrollSwitch().then((state) => {
console.log(`getTouchpadScrollSwitch success, state: ${JSON.stringify(state)}`);
});
} catch (error) {
console.log(`getTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setTouchpadScrollDirection10+
setTouchpadScrollDirection(state: boolean, callback: AsyncCallback\): void
设置触控板滚轴的方向,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------- |
| state | boolean | 是 | state为触控板滚轴的方向。
true与手指滑动的方向一致,false与手指滑动的方向相反,
默认为true。 |
| callback | AsyncCallback\ | 是 | 回调函数。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setTouchpadScrollDirection(true, (error: Error) => {
if (error) {
console.log(`setTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`setTouchpadScrollDirection success`);
});
} catch (error) {
console.log(`setTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setTouchpadScrollDirection10+
setTouchpadScrollDirection(state: boolean): Promise\
设置触控板滚轴的方向,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| state | boolean| 是 | state为触控板滚轴的方向。
true与手指滑动的方向一致,false与手指滑动的方向相反。
默认为true|
**返回值**:
| 参数 | 说明 |
| ------------------- | ---------------- |
| Promise\ | Promise对象。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setTouchpadScrollDirection (false).then(() => {
console.log(`setTouchpadScrollDirection success`);
});
} catch (error) {
console.log(`setTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getTouchpadScrollDirection10+
getTouchpadScrollDirection(callback: AsyncCallback\): void
获取触控板滚轴方向,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\ | 是 | 回调函数,异步返回触控板滚轴方向。
true与手指滑动的方向一致,false与手指滑动的方向相反。
默认为true |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getTouchpadScrollDirection ((error: Error, state: boolean) => {
console.log(`getTouchpadScrollDirection success, state: ${JSON.stringify(state)}`);
});
} catch (error) {
console.log(`getTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getTouchpadScrollDirection10+
getTouchpadScrollDirection(): Promise\
获取触控板滚轴方向,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| Promise\ | Promise实例,异步返回触控板滚轴方向。
true与手指滑动的方向一致,false与手指滑动的方向相反。
默认为true |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getTouchpadScrollDirection().then((state: boolean) => {
console.log(`getTouchpadScrollDirection success, state: ${JSON.stringify(state)}`);
});
} catch (error) {
console.log(`getTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setTouchpadTapSwitch10+
setTouchpadTapSwitch(state: boolean, callback: AsyncCallback\): void
设置触控板轻触功能开关,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------- |
| state | boolean | 是 |触控板轻触功能开关开启状态。 true代表轻触开启,false代表轻触关闭,默认开启。 |
| callback | AsyncCallback\ | 是 | 回调函数。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setTouchpadTapSwitch(true, (error: Error) => {
if (error) {
console.log(`setTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`setTouchpadTapSwitch success`);
});
} catch (error) {
console.log(`setTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setTouchpadTapSwitch 10+
setTouchpadTapSwitch(state: boolean): Promise\
设置触控板轻触功能开关,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| state | boolean| 是 | 触控板轻触功能开关开启状态, true代表轻触开启,false代表轻触关闭,默认开启。 |
**返回值**:
| 参数 | 说明 |
| ------------------- | ---------------- |
| Promise\ | Promise对象。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setTouchpadTapSwitch(false).then(() => {
console.log(`setTouchpadTapSwitch success`);
});
} catch (error) {
console.log(`setTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getTouchpadTapSwitch10+
getTouchpadTapSwitch(callback: AsyncCallback\): void
获取触控板轻触能力开启状态,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\ | 是 | 回调函数,异步返回触控板轻触功能开启状态, true代表开启,false代表关闭,默认开启。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getTouchpadTapSwitch((error: Error, state: boolean) => {
console.log(`getTouchpadTapSwitch success, state: ${JSON.stringify(state)}`);
});
} catch (error) {
console.log(`getTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getTouchpadTapSwitch10+
getTouchpadTapSwitch(): Promise\
获取触控板轻触功能开启状态,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| Promise\ | Promise实例,异步返回触控板轻触功能开启状态,true代表开启,false代表关闭,默认开启。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getTouchpadTapSwitch().then((state: boolean) => {
console.log(`getTouchpadTapSwitch success, state: ${JSON.stringify(state)}`);
});
} catch (error) {
console.log(`getTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setTouchpadPointerSpeed10+
setTouchpadPointerSpeed(speed: number, callback: AsyncCallback\): void
设置触控板光标移动速度,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------- |
| speed | number | 是 |speed代表光标移动速度。speed取值范围[1,11],默认6。 |
| callback | AsyncCallback\ | 是 | 回调函数。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setTouchpadPointerSpeed(1, (error: Error) => {
if (error) {
console.log(`setTouchpadPointerSpeedfailed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`setTouchpadPointerSpeed success`);
});
} catch (error) {
console.log(`setTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setTouchpadPointerSpeed10+
setTouchpadPointerSpeed(speed: number): Promise\
设置触控板光标移动速度,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| speed| number | 是 | speed代表光标移动速度。speed取值范围[1,11],默认6。 |
**返回值**:
| 参数 | 说明 |
| ------------------- | ---------------- |
| Promise\ | Promise对象。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setTouchpadPointerSpeed(10).then(() => {
console.log(`setTouchpadPointerSpeed success`);
});
} catch (error) {
console.log(`setTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getTouchpadPointerSpeed10+
getTouchpadPointerSpeed(callback: AsyncCallback\): void
获取触控板光标移动速度,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\ | 是 | 回调函数,异步返回触控板光标移动速度。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getTouchpadPointerSpeed((error: Error, speed: number) => {
console.log(`getTouchpadPointerSpeed success, speed: ${JSON.stringify(speed)}`);
});
} catch (error) {
console.log(`getTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getTouchpadPointerSpeed10+
getTouchpadPointerSpeed(): Promise\
获取触控板光标移动速度,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| Promise\ | Promise实例,异步返回触控板光标移动速度。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getTouchpadPointerSpeed().then((speed: number) => {
console.log(`getTouchpadPointerSpeed success, speed: ${JSON.stringify(speed)}`);
});
} catch (error) {
console.log(`getTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setTouchpadPinchSwitch10+
setTouchpadPinchSwitch(state: boolean, callback: AsyncCallback\): void
设置触控板双指捏合功能开关,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------- |
| state | boolean | 是 |触控板双指捏合功能开关开启状态。 true代表开启,false代表关闭,默认开启。 |
| callback | AsyncCallback\ | 是 | 回调函数。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setTouchpadTapSwitch(true, (error: Error) => {
if (error) {
console.log(`setTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`setTouchpadPinchSwitch success`);
});
} catch (error) {
console.log(`setTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setTouchpadPinchSwitch10+
setTouchpadPinchSwitch(state: boolean): Promise\
设置触控板双指捏合功能开关,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| state | boolean| 是 | 触控板双指捏合功能开关开启状态。 true代表开启,false代表关闭,默认开启。 |
**返回值**:
| 参数 | 说明 |
| ------------------- | ---------------- |
| Promise\ | Promise对象。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setTouchpadPinchSwitch(false).then(() => {
console.log(`setTouchpadPinchSwitch success`);
});
} catch (error) {
console.log(`setTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getTouchpadPinchSwitch10+
getTouchpadPinchSwitch(callback: AsyncCallback\): void
获取触控板双指捏合功能开启状态,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\ | 是 | 回调函数,异步返回触控板双指捏合功能开启状态。true代表功能开启,false代表功能关闭,默认开启。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getTouchpadPinchSwitch((error: Error, state: boolean) => {
console.log(`getTouchpadPinchSwitch success, state: ${JSON.stringify(state)}`);
});
} catch (error) {
console.log(`getTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getTouchpadPinchSwitch10+
getTouchpadPinchSwitch(): Promise\
获取触控板双指捏合功能开启状态,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| Promise\ | Promise实例,异步返回触控板双指捏合功能开启状态。true代表功能开启,false代表功能关闭,默认开启。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getTouchpadPinchSwitch().then((state: boolean) => {
console.log(`getTouchpadPinchSwitch success, state: ${JSON.stringify(state)}`);
});
} catch (error) {
console.log(`getTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setTouchpadSwipeSwitch10+
setTouchpadSwipeSwitch(state: boolean, callback: AsyncCallback\): void
设置触控板多指滑动功能开关,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------- |
| state | boolean | 是 |触控板多指滑动开关开启状态。 true代表多指滑动开启,false代表多指滑动关闭,默认开启。 |
| callback | AsyncCallback\ | 是 | 回调函数。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setTouchpadSwipeSwitch(true, (error: Error) => {
if (error) {
console.log(`setTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`setTouchpadSwipeSwitch success`);
});
} catch (error) {
console.log(`setTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setTouchpadSwipeSwitch10+
setTouchpadSwipeSwitch(state: boolean): Promise\
设置触控板多指滑动功能开关,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| state | boolean| 是 | 触控板多指滑动功能开关开启状态。 true代表多指滑动开启,false代表多指滑动关闭,默认开启。 |
**返回值**:
| 参数 | 说明 |
| ------------------- | ---------------- |
| Promise\ | Promise对象。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setTouchpadSwipeSwitch(false).then(() => {
console.log(`setTouchpadSwipeSwitch success`);
});
} catch (error) {
console.log(`setTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getTouchpadSwipeSwitch10+
getTouchpadSwipeSwitch(callback: AsyncCallback\): void
获取触控板多指滑动功能开启状态,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\ | 是 | 回调函数,异步返回触控板多指滑动功能开启状态。 true代表多指滑动开启,false代表多指滑动关闭,默认开启。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getTouchpadSwipeSwitch((error: Error, state: boolean) => {
console.log(`getTouchpadSwipeSwitch success, state: ${JSON.stringify(state)}`);
});
} catch (error) {
console.log(`getTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getTouchpadSwipeSwitch10+
getTouchpadSwipeSwitch(): Promise\
获取触控板多指滑动功能开启状态,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| Promise\ | Promise实例,异步返回触控板多指滑动功能开启状态。 true代表多指滑动开启,false代表多指滑动关闭,默认开启。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getTouchpadSwipeSwitch().then((state: boolean) => {
console.log(`getTouchpadSwipeSwitch success, state: ${JSON.stringify(state)}`);
});
} catch (error) {
console.log(`getTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setTouchpadRightClickType10+
setTouchpadRightClickType(type: RightClickType, callback: AsyncCallback\): void
设置触控板右键菜单类型,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------- |
| type| [RightClickType](js-apis-pointer.md#rightclicktype10)| 是 |type代表触控板右键菜单类型。
- TOUCHPAD_RIGHT_BUTTON:触控板右键区域。
- TOUCHPAD_LEFT_BUTTON:触控板左键区域。
- TOUCHPAD_TWO_FINGER_TAP:双指轻击或按压触控板。
默认为TOUCHPAD_RIGHT_BUTTON 。 |
| callback | AsyncCallback\ | 是 | 回调函数。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setTouchpadRightClickType(pointer.RightClickType.TOUCHPAD_RIGHT_BUTTON , (error: Error) => {
if (error) {
console.log(`setTouchpadRightClickType, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`setTouchpadRightClickType success`);
});
} catch (error) {
console.log(`setTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setTouchpadRightClickType10+
setTouchpadRightClickType(type: RightClickType): Promise\
设置触控板右键菜单类型,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| type| [RightClickType](js-apis-pointer.md#rightclicktype10)| 是 | type代表触控板右键菜单类型。
- TOUCHPAD_RIGHT_BUTTON:触控板右键区域。
- TOUCHPAD_LEFT_BUTTON:触控板左键区域。
- TOUCHPAD_TWO_FINGER_TAP:双指轻击或按压触控板。
默认为TOUCHPAD_RIGHT_BUTTON 。 |
**返回值**:
| 参数 | 说明 |
| ------------------- | ---------------- |
| Promise\ | Promise对象。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setTouchpadRightClickType(pointer.RightClickType.TOUCHPAD_RIGHT_BUTTON).then(() => {
console.log(`setTouchpadRightClickType success`);
});
} catch (error) {
console.log(`setTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getTouchpadRightClickType10+
getTouchpadRightClickType(callback: AsyncCallback\): void
获取触控板右键菜单类型,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\<[RightClickType](js-apis-pointer.md#rightclicktype10)> | 是 | 回调函数,异步返回触控板右键菜单类型。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getTouchpadRightClickType((error: Error, type: pointer.RightClickType) => {
console.log(`getTouchpadRightClickType success, type: ${JSON.stringify(type)}`);
});
} catch (error) {
console.log(`getTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getTouchpadRightClickType10+
getTouchpadRightClickType(): Promise\
获取触控板右键菜单类型,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| Promise\<[RightClickType](js-apis-pointer.md#rightclicktype10) > | Promise实例,异步返回触控板右键菜单类型。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getTouchpadRightClickType().then((type: pointer.RightClickType) => {
console.log(`getTouchpadRightClickType success, typeed: ${JSON.stringify(type)}`);
});
} catch (error) {
console.log(`getTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setPointerSize10+
setPointerSize(size: number, callback: AsyncCallback<void>): void
设置鼠标光标大小,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------- |
| size | number | 是 | 鼠标光标大小,范围为[1-7],默认为1。 |
| callback | AsyncCallback<void> | 是 | 回调函数,当设置成功时,err为undefined,否则为错误对象。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setPointerSize(1, (error: Error) => {
if (error) {
console.log(`setPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`setPointerSize success`);
});
} catch (error) {
console.log(`setPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setPointerSize10+
setPointerSize(size: number): Promise<void>
设置鼠标光标大小,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| size | number | 是 | 鼠标光标大小,范围为[1-7],默认为1。 |
**返回值**:
| 参数 | 说明 |
| ------------------- | ---------------- |
| Promise<void> | 无返回结果的Promise对象。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setPointerSize(3).then(() => {
console.log(`setPointerSize success`);
});
} catch (error) {
console.log(`setPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setPointerSizeSync10+
setPointerSizeSync(size: number): void;
设置鼠标光标大小,使用同步方式进行设置。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| size | number | 是 | 鼠标光标大小,范围为[1-7],默认为1。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setPointerSizeSync(5);
console.log(`setPointerSizeSync success`);
} catch (error) {
console.log(`setPointerSizeSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getPointerSize10+
getPointerSize(callback: AsyncCallback<number>): void
获取鼠标光标大小,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback<number> | 是 | 回调函数,异步返回鼠标光标大小。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getPointerSize((error: Error, size: number) => {
console.log(`getPointerSize success, size: ${JSON.stringify(size)}`);
});
} catch (error) {
console.log(`getPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getPointerSize10+
getPointerSize(): Promise<number>
获取当前鼠标光标大小,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| Promise<number> | Promise对象,异步返回鼠标光标大小。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
**示例**:
```js
try {
pointer.getPointerSize().then((size: number) => {
console.log(`getPointerSize success, size: ${JSON.stringify(size)}`);
});
} catch (error) {
console.log(`getPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getPointerSizeSync10+
getPointerSizeSync(): number
获取鼠标光标大小,使用同步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| number | 鼠标光标大小。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
**示例**:
```js
try {
let pointerSize = pointer.getPointerSizeSync();
console.log(`getPointerSizeSync success, pointerSize: ${JSON.stringify(pointerSize)}`);
} catch (error) {
console.log(`getPointerSizeSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setPointerColor10+
setPointerColor(color: number, callback: AsyncCallback<void>): void
设置鼠标光标颜色,使用AsyncCallback异步方式返回结果。
**说明**
>
> 设置和调试时,需连接外部设备,如鼠标、蓝牙等。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------- |
| color | number | 是 | 鼠标光标颜色,默认为黑色:0x000000。 |
| callback | AsyncCallback<void> | 是 | 回调函数,当设置成功时,err为undefined,否则为错误对象。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setPointerColor(0xF6C800, (error: Error) => {
if (error) {
console.log(`setPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`setPointerColor success`);
});
} catch (error) {
console.log(`setPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setPointerColor10+
setPointerColor(color: number): Promise<void>
设置鼠标光标颜色,使用Promise异步方式返回结果。
**说明**
>
> 设置和调试时,需连接外部设备,如鼠标、蓝牙等。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| color | number | 是 | 鼠标光标颜色,默认为黑色:0x000000。 |
**返回值**:
| 参数 | 说明 |
| ------------------- | ---------------- |
| Promise<void> | 无返回结果的Promise对象。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setPointerColor(0xF6C800).then(() => {
console.log(`setPointerColor success`);
});
} catch (error) {
console.log(`setPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setPointerColorSync10+
setPointerColorSync(color: number): void;
设置鼠标光标颜色,使用同步方式进行设置。
**说明**
>
> 设置和调试时,需连接外部设备,如鼠标、蓝牙等。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| color | number | 是 | 鼠标光标颜色,默认为黑色:0x000000。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setPointerColorSync(0xF6C800);
console.log(`setPointerColorSync success`);
} catch (error) {
console.log(`setPointerColorSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getPointerColor10+
getPointerColor(callback: AsyncCallback<number>): void
获取鼠标光标颜色,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback<number> | 是 | 回调函数,异步返回鼠标光标颜色。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getPointerColor((error: Error, color: number) => {
console.log(`getPointerColor success, color: ${JSON.stringify(color)}`);
});
} catch (error) {
console.log(`getPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getPointerColor10+
getPointerColor(): Promise<number>
获取当前鼠标光标颜色,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| Promise<number> | Promise对象,异步返回鼠标光标颜色。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
**示例**:
```js
try {
pointer.getPointerColor().then((color: number) => {
console.log(`getPointerColor success, color: ${JSON.stringify(color)}`);
});
} catch (error) {
console.log(`getPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getPointerColorSync10+
getPointerColorSync(): number
获取鼠标光标颜色,使用同步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| number | 鼠标光标颜色。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
**示例**:
```js
try {
let pointerColor = pointer.getPointerColorSync();
console.log(`getPointerColorSync success, pointerColor: ${JSON.stringify(pointerColor)}`);
} catch (error) {
console.log(`getPointerColorSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setTouchpadDoubleTapAndDragState14+
setTouchpadDoubleTapAndDragState(isOpen: boolean, callback: AsyncCallback\): void
设置触控板双击拖拽开关状态,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------- |
| isOpen | boolean | 是 | 双击拖拽开关的状态,true代表开启,false代表关闭。|
| callback | AsyncCallback\ | 是 | 回调函数。|
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setTouchpadDoubleTapAndDragState(true, (error: Error) => {
if (error) {
console.log(`setTouchpadDoubleTapAndDragState failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`setTouchpadDoubleTapAndDragState success`);
});
} catch (error) {
console.log(`setTouchpadDoubleTapAndDragState failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.setTouchpadDoubleTapAndDragState14+
setTouchpadDoubleTapAndDragState(isOpen: boolean): Promise\
设置触控板双击拖拽开关状态,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | ----------------------------------- |
| state | boolean| 是 | 双击拖拽开关的状态,true代表开启,false代表关闭。 |
**返回值**:
| 参数 | 说明 |
| ------------------- | ---------------- |
| Promise\ | 无返回结果的Promise对象。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.setTouchpadDoubleTapAndDragState(false).then(() => {
console.log(`setTouchpadDoubleTapAndDragState success`);
});
} catch (error) {
console.log(`setTouchpadDoubleTapAndDragState failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getTouchpadDoubleTapAndDragState14+
getTouchpadDoubleTapAndDragState(callback: AsyncCallback\): void
获取触控板双击拖拽开关的开启状态,使用AsyncCallback异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**参数**:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\ | 是 | 回调函数,异步返回触控板双击拖拽开关的开启状态。返回true代表开启,返回false代表关闭。 |
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**示例**:
```js
try {
pointer.getTouchpadDoubleTapAndDragState((error: Error, state: boolean) => {
console.log(`getTouchpadDoubleTapAndDragState success, state: ${JSON.stringify(state)}`);
});
} catch (error) {
console.log(`getTouchpadDoubleTapAndDragState failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## pointer.getTouchpadDoubleTapAndDragState14+
getTouchpadDoubleTapAndDragState(): Promise\
获取触控板双击拖拽开关的开启状态,使用Promise异步方式返回结果。
**系统能力**:SystemCapability.MultimodalInput.Input.Pointer
**系统API**: 此接口为系统接口。
**返回值**:
| 参数 | 说明 |
| --------------------- | ------------------- |
| Promise\ | Promise实例,异步返回触控板双击拖拽开启状态。true代表开启,false代表关闭。|
**错误码**:
以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
**示例**:
```js
try {
pointer.getTouchpadDoubleTapAndDragState().then((state) => {
console.log(`getTouchpadDoubleTapAndDragState success, state: ${JSON.stringify(state)}`);
});
} catch (error) {
console.log(`getTouchpadDoubleTapAndDragState failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```