---
name: "XmTextFieldSetSelection"
section: "3"
platform: "linux"
package: "openmotif"
version: "2.3.8-4"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/XmTextFieldSetSelection"
---

# XmTextFieldSetSelection(3)

A TextField function that sets the primary selection of the text

## NAME

**XmTextFieldSetSelection** — A TextField function that sets the primary selection of the text

## SYNOPSIS

```
#include <Xm/TextF.h>
void XmTextFieldSetSelection(
Widget widget,
XmTextPosition first,
XmTextPosition last,
Time time);
```

## DESCRIPTION

**XmTextFieldSetSelection** sets the primary selection of the text in the widget. It also sets the insertion cursor position to the last position of the selection and calls the widget's **XmNmotionVerifyCallback** callbacks. **XmTextFieldSetSelection** always generates an **XmNgainPrimaryCallback** unless it fails to take ownership of the primary text selection.

- *widget*

  Specifies the TextField widget ID

- *first*

  Marks the first character position of the text to be selected

- *last*

  Marks the last position of the text to be selected

- *time*

  Specifies the time at which the selection value is desired. This should be the same as the time of the event that triggered this request. One source of a valid time stamp is the function **XtLastTimestampProcessed**.

For a complete definition of TextField and its associated resources, see [**XmTextField**(3)](/XmTextField/3.md).

## RELATED

[**XmTextField**(3)](/XmTextField/3.md).
