<!--
{
  "availability" : [
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGEvent/setIntegerValueField(_:value:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Graphics",
      "CoreGraphics"
    ],
    "preciseIdentifier" : "c:@F@CGEventSetIntegerValueField"
  },
  "title" : "setIntegerValueField(_:value:)"
}
-->

# setIntegerValueField(_:value:)

Sets the integer value of a field in a Quartz event.

```
func setIntegerValueField(_ field: CGEventField, value: Int64)
```

## Parameters

`field`

A field in the specified event. Pass one of the constants listed in [`CGEventField`](/documentation/CoreGraphics/CGEventField).

`value`

The new value of the specified field.

## Discussion

Before calling this function, the event type must be set using a typed event creation function such as [`init(mouseEventSource:mouseType:mouseCursorPosition:mouseButton:)`](/documentation/CoreGraphics/CGEvent/init(mouseEventSource:mouseType:mouseCursorPosition:mouseButton:)), or by calling [`CGEventSetType`](/documentation/CoreGraphics/CGEventSetType).

If you are creating a mouse event generated by a tablet, call this function and specify the field `kCGMouseEventSubtype` with a value of `kCGEventMouseSubtypeTabletPoint` or `kCGEventMouseSubtypeTabletProximity` before setting other parameters.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)