# @ohos.multimodalInput.pointer (Mouse Pointer) (System API)
The **pointer** module provides APIs related to pointer attribute management.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> This topic describes only system APIs provided by the module. For details about its public APIs, see [@ohos.multimodalInput.pointer (Mouse Pointer)](js-apis-pointer.md).
## Modules to Import
```js
import { pointer } from '@kit.InputKit';
```
## pointer.setPointerSpeed
setPointerSpeed(speed: number, callback: AsyncCallback<void>): void
Sets the moving speed of the mouse pointer. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ------------------------------------- |
| speed | number | Yes | Moving speed of the mouse pointer. The value ranges from **1** to **11**. The default value is **7**. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID| Error Message |
| -------- | ----------------- |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.2.Incorrect parameter types.3.Parameter verification failed. |
**Example**
```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>
Sets the moving speed of the mouse pointer. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------------------------------- |
| speed | number | Yes | Moving speed of the mouse pointer. The value ranges from **1** to **11**. The default value is **7**.|
**Return value**
| Name | Description |
| ------------------- | ---------------- |
| Promise<void> | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Screen Hopping Error Codes](../apis-distributedservice-kit/errorcode-devicestatus.md).
| ID| Error Message |
| -------- | ----------------- |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.2.Incorrect parameter types.3.Parameter verification failed. |
**Example**
```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
Sets the moving speed of the mouse pointer. This API returns the result synchronously.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------------------------------- |
| speed | number | Yes | Moving speed of the mouse pointer. The value ranges from **1** to **11**. The default value is **7**.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Obtains the moving speed of the mouse pointer. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback<number> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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>
Obtains the moving speed of the mouse pointer. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Return value**
| Name | Description |
| --------------------- | ------------------- |
| Promise<number> | Promise used to return the result.|
**Example**
```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
Obtains the moving speed of the mouse pointer. This API returns the result synchronously.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Return value**
| Name | Description |
| --------------------- | ------------------- |
| number | Moving speed of the mouse pointer.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Sets the status of the mouse hover scroll switch. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ------------------------------------- |
| state | boolean | Yes | Status of the mouse hover scroll switch. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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>
Sets the status of the mouse hover scroll switch. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------------------------------- |
| state | boolean | Yes | Status of the mouse hover scroll switch. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite.|
**Return value**
| Name | Description |
| ------------------- | ---------------- |
| Promise<void> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Obtains the status of the mouse hover scroll switch. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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>
Obtains the status of the mouse hover scroll switch. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Return value**
| Name | Description |
| --------------------- | ------------------- |
| Promise<boolean> | Promise used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Sets the primary button of the mouse. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ------------------------------------- |
| primary | [PrimaryButton](js-apis-pointer.md#primarybutton10) | Yes | ID of the primary mouse button. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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>
Sets the primary button of the mouse. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------------------------------- |
| primary | [PrimaryButton](js-apis-pointer.md#primarybutton10) | Yes | ID of the primary mouse button.|
**Return value**
| Name | Description |
| ------------------- | ---------------- |
| Promise<void> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Obtains the primary button of the mouse. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback<[PrimaryButton](js-apis-pointer.md#primarybutton10)> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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>
Obtains the primary button of the mouse. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Return value**
| Name | Description |
| --------------------- | ------------------- |
| Promise<[PrimaryButton](js-apis-pointer.md#primarybutton10)> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Sets the number of mouse scroll rows. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ------------------------------------- |
| rows | number | Yes | Number of mouse scroll rows. The value ranges from 1 to 100. The default value is **3**. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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>
Sets the number of mouse scroll rows. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------------------------------- |
| rows | number | Yes | Number of mouse scroll rows. The value ranges from 1 to 100. The default value is **3**.|
**Return value**
| Name | Description |
| ------------------- | ---------------- |
| Promise<void> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Obtains the number of mouse scroll rows. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback<number> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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>
Obtains the moving speed of the mouse pointer. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Return value**
| Name | Description |
| --------------------- | ------------------- |
| Promise<number> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Sets the scroll switch of the touchpad. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ------------------------------------- |
| state | boolean | Yes | Scroll switch status. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**. |
| callback | AsyncCallback\ | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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\
Sets the scroll switch of the touchpad. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------------------------------- |
| state | boolean| Yes | Scroll switch status. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.|
**Return value**
| Name | Description |
| ------------------- | ---------------- |
| Promise\ | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Obtains the scroll switch status of the touchpad. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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\
Obtains the scroll switch status of the touchpad. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Return value**
| Name | Description |
| --------------------- | ------------------- |
| Promise\ | Promise used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Sets the scroll direction of the touchpad. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ------------------------------------- |
| state | boolean | Yes | Scroll direction of the touchpad.
The value **true** indicates that the scroll direction is the same as the finger moving direction, and the value **false** indicates the opposite.
The default value is **true**. |
| callback | AsyncCallback\ | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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\
Sets the scroll direction of the touchpad. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------------------------------- |
| state | boolean| Yes | Scroll direction of the touchpad.
The value **true** indicates that the scroll direction is the same as the finger moving direction, and the value **false** indicates the opposite.
The default value is **true**.|
**Return value**
| Name | Description |
| ------------------- | ---------------- |
| Promise\ | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Obtains the scroll direction of the touchpad. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\ | Yes | Callback used to return the result.
The value **true** indicates that the scroll direction is the same as the finger moving direction, and the value **false** indicates the opposite.
The default value is **true**.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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\
Obtains the scroll direction of the touchpad. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Return value**
| Name | Description |
| --------------------- | ------------------- |
| Promise\ | Promise used to return the result.
The value **true** indicates that the scroll direction is the same as the finger moving direction, and the value **false** indicates the opposite.
The default value is **true**.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Sets the tap switch of the touchpad. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ------------------------------------- |
| state | boolean | Yes |Tap switch status of the touchpad The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**. |
| callback | AsyncCallback\ | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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\
Sets the tap switch of the touchpad. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------------------------------- |
| state | boolean| Yes | Tap switch status of the touchpad. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**. |
**Return value**
| Name | Description |
| ------------------- | ---------------- |
| Promise\ | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Obtains the tap switch status of the touchpad. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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\
Obtains the tap switch status of the touchpad. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Return value**
| Name | Description |
| --------------------- | ------------------- |
| Promise\ | Promise used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Sets the mouse pointer moving speed of the touchpad. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ------------------------------------- |
| speed | number | Yes |Mouse pointer moving speed of the touchpad. The value range is [1,11]. The default value is **6**. |
| callback | AsyncCallback\ | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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\
Sets the mouse pointer moving speed of the touchpad. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------------------------------- |
| speed| number | Yes | Mouse pointer moving speed of the touchpad. The value range is [1,11]. The default value is **6**. |
**Return value**
| Name | Description |
| ------------------- | ---------------- |
| Promise\ | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Obtains the mouse pointer moving speed of the touchpad. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\ | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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\
Obtains the mouse pointer moving speed of the touchpad. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Return value**
| Name | Description |
| --------------------- | ------------------- |
| Promise\ | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Sets the pinch switch of the touchpad. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ------------------------------------- |
| state | boolean | Yes |Pinch switch status of the touchpad. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**. |
| callback | AsyncCallback\ | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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\
Sets the pinch switch of the touchpad. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------------------------------- |
| state | boolean| Yes | Pinch switch status of the touchpad. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**. |
**Return value**
| Name | Description |
| ------------------- | ---------------- |
| Promise\ | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Obtains the pinch switch status of the touchpad. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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\
Obtains the pinch switch status of the touchpad. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Return value**
| Name | Description |
| --------------------- | ------------------- |
| Promise\ | Promise used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Sets the multi-finger swipe switch of the touchpad. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ------------------------------------- |
| state | boolean | Yes |Swipe switch status of the touchpad. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**. |
| callback | AsyncCallback\ | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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\
Sets the swipe switch of the touchpad. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------------------------------- |
| state | boolean| Yes | Swipe switch status of the touchpad. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**. |
**Return value**
| Name | Description |
| ------------------- | ---------------- |
| Promise\ | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Obtains the multi-finger swipe switch status of the touchpad. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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\
Obtains the multi-finger swipe switch status of the touchpad. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Return value**
| Name | Description |
| --------------------- | ------------------- |
| Promise\ | Promise used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Sets the shortcut menu type of the touchpad. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ------------------------------------- |
| type| [RightClickType](js-apis-pointer.md#rightclicktype10)| Yes |Shortcut menu type of the touchpad.
- TOUCHPAD_RIGHT_BUTTON: tapping the right-button area of the touchpad.
- TOUCHPAD_LEFT_BUTTON: tapping the left-button area of the touchpad.
- TOUCHPAD_TWO_FINGER_TAP: tapping or pressing the touchpad with two fingers.
The default value is **TOUCHPAD_RIGHT_BUTTON**. |
| callback | AsyncCallback\ | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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\
Sets the shortcut menu type of the touchpad. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------------------------------- |
| type| [RightClickType](js-apis-pointer.md#rightclicktype10)| Yes | Shortcut menu type of the touchpad.
- TOUCHPAD_RIGHT_BUTTON: tapping the right-button area of the touchpad.
- TOUCHPAD_LEFT_BUTTON: tapping the left-button area of the touchpad.
- TOUCHPAD_TWO_FINGER_TAP: tapping or pressing the touchpad with two fingers.
The default value is **TOUCHPAD_RIGHT_BUTTON**.|
**Return value**
| Name | Description |
| ------------------- | ---------------- |
| Promise\ | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Obtains the shortcut menu type of the touchpad. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\<[RightClickType](js-apis-pointer.md#rightclicktype10)> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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\
Obtains the shortcut menu type of the touchpad. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Return value**
| Name | Description |
| --------------------- | ------------------- |
| Promise\<[RightClickType](js-apis-pointer.md#rightclicktype10) > | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Sets the pointer size. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ------------------------------------- |
| size | number | Yes | Pointer size. The value ranges from **1** to **7**. The default value is **1**. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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>
Sets the pointer size. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------------------------------- |
| size | number | Yes | Pointer size. The value ranges from **1** to **7**. The default value is **1**.|
**Return value**
| Name | Description |
| ------------------- | ---------------- |
| Promise<void> | Promise that returns no value.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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;
Sets the pointer size. This API returns the result synchronously.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------------------------------- |
| size | number | Yes | Pointer size. The value ranges from **1** to **7**. The default value is **1**.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Obtains the pointer size. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback<number> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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>
Obtains the pointer size. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Return value**
| Name | Description |
| --------------------- | ------------------- |
| Promise<number> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
**Example**
```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
Obtains the pointer size. This API returns the result synchronously.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Return value**
| Name | Description |
| --------------------- | ------------------- |
| number | Pointer size. |
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
**Example**
```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
Sets the pointer color. This API uses an asynchronous callback to return the result.
**NOTE**
>
> When performing this operation, you need to connect an external device, such as a mouse or Bluetooth device.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ------------------------------------- |
| color | number | Yes | Pointer color. The default value is **black** (0x000000). |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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>
Sets the pointer color. This API uses a promise to return the result.
**NOTE**
>
> When performing this operation, you need to connect an external device, such as a mouse or Bluetooth device.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------------------------------- |
| color | number | Yes | Pointer color. The default value is **black** (0x000000).|
**Return value**
| Name | Description |
| ------------------- | ---------------- |
| Promise<void> | Promise that returns no value.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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;
Sets the pointer color. This API returns the result synchronously.
**NOTE**
>
> When performing this operation, you need to connect an external device, such as a mouse or Bluetooth device.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------------------------------- |
| color | number | Yes | Pointer color. The default value is **black** (0x000000).|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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
Obtains the pointer color. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback<number> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. |
**Example**
```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>
Obtains the pointer color. This API uses a promise to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Return value**
| Name | Description |
| --------------------- | ------------------- |
| Promise<number> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
**Example**
```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
Obtains the pointer color. This API returns the result synchronously.
**System capability**: SystemCapability.MultimodalInput.Input.Pointer
**System API**: This is a system API.
**Return value**
| Name | Description |
| --------------------- | ------------------- |
| number | Pointer color.|
**Error codes**
For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
| ID | Error Message |
| ---- | --------------------- |
| 202 | SystemAPI permission error. |
**Example**
```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`])}`);
}
```