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

# XmTextFieldSetMaxLength(3)

A TextField function that sets the value of the current maximum allowable length of a text string entered from the keyboard

## NAME

**XmTextFieldSetMaxLength** — A TextField function that sets the value of the current maximum allowable length of a text string entered from the keyboard

## SYNOPSIS

```
#include <Xm/TextF.h>
void XmTextFieldSetMaxLength(
Widget widget,
int max_length);
```

## DESCRIPTION

**XmTextFieldSetMaxLength** sets the value of the current maximum allowable length of the text string in the TextField widget. The maximum allowable length prevents the user from entering a text string from the keyboard that is larger than this limit. Strings that are entered using the **XmNvalue** (or **XmNvalueWcs**) resource, or the **XmTextFieldSetString** (or **XmTextFieldSetStringWcs**) function ignore this resource.

- *widget*

  Specifies the TextField widget ID

- *max\_length*

  Specifies the maximum allowable length of the text string

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

## RELATED

[**XmText**(3)](/XmText/3.md), [**XmTextFieldSetString**(3)](/XmTextFieldSetString/3.md), and [**XmTextFieldSetStringWcs**(3)](/XmTextFieldSetStringWcs/3.md).
