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

# XmTextFieldGetSelection(3)

A TextField function that retrieves the value of the primary selection

## NAME

**XmTextFieldGetSelection** — A TextField function that retrieves the value of the primary selection

## SYNOPSIS

```
#include <Xm/TextF.h>
char * XmTextFieldGetSelection(
Widget widget);
```

## DESCRIPTION

**XmTextFieldGetSelection** retrieves the value of the primary selection. It returns a NULL pointer if no text is selected in the widget. The application is responsible for freeing the storage associated with the string by calling **XtFree**.

- *widget*

  Specifies the TextField widget ID

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

## RETURN

Returns a character pointer to the string that is associated with the primary selection.

## RELATED

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