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

# setDoubleValueField(_:value:)

Sets the floating-point value of a field in a Quartz event.

```
func setDoubleValueField(_ field: CGEventField, value: Double)
```

## 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).

In cases where the field’s value is represented within the event by a fixed point number or integer, the `value` parameter is scaled as needed and converted to the appropriate type.

---

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)