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

# XmGetFocusWidget(3)

Returns the ID of the widget that has keyboard focus

## NAME

**XmGetFocusWidget** — Returns the ID of the widget that has keyboard focus

## SYNOPSIS

```
#include <Xm/Xm.h>
Widget XmGetFocusWidget(
Widget widget);
```

## DESCRIPTION

**XmGetFocusWidget** examines the hierarchy that contains the specified widget and returns the ID of the widget that has keyboard focus. The function extracts the widget ID from the associated Shell widget; therefore, the specified widget can be located anywhere in the hierarchy.

- *widget*

  Specifies a widget ID within a given hierarchy

## RETURN

Returns the ID of the widget with keyboard focus. If no child of the Shell has focus, the function returns NULL.

## RELATED

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