menu\_hook(3X) Library calls menu\_hook(3X)

# [NAME](#NAME)

**menu\_hook** - set hooks for automatic invocation by applications

# [SYNOPSIS](#SYNOPSIS)

```
#include <menu.h>
```

```
int set_item_init(MENU *menu, Menu_Hook func);
Menu_Hook item_init(const MENU *menu);
```

```
int set_item_term(MENU *menu, Menu_Hook func);
Menu_Hook item_term(const MENU *menu);
```

```
int set_menu_init(MENU *menu, Menu_Hook func);
Menu_Hook menu_init(const MENU *menu);
```

```
int set_menu_term(MENU *menu, Menu_Hook func);
Menu_Hook menu_term(const MENU *menu);
```

# [DESCRIPTION](#DESCRIPTION)

These functions make it possible to set hook functions to be called at various points in the automatic processing of input event codes by **menu\_driver**.

The function **set\_item\_init** sets a hook to be called at menu-post time and each time the selected item changes (after the change). **item\_init** returns the current item init hook, if any (*NULL* if there is no such hook).

The function **set\_item\_term** sets a hook to be called at menu-unpost time and each time the selected item changes (before the change). **item\_term** returns the current item term hook, if any (*NULL* if there is no such hook).

The function **set\_menu\_init** sets a hook to be called at menu-post time and just after the top row on the menu changes once it is posted. **menu\_init** returns the current menu init hook, if any (*NULL* if there is no such hook).

The function **set\_menu\_term** sets a hook to be called at menu-unpost time and just before the top row on the menu changes once it is posted. **menu\_term** returns the current menu term hook, if any (*NULL* if there is no such hook).

# [RETURN VALUE](#RETURN_VALUE)

Routines that return pointers return *NULL* on error. Other routines return one of the following:

[**E\_OK**](#E_OK)

The routine succeeded.

[**E\_SYSTEM\_ERROR**](#E_SYSTEM_ERROR)

System error occurred (see [**errno**(3)](/man/os/ncurses/errno.3)).

# [PORTABILITY](#PORTABILITY)

These routines emulate the System V menu library. They were not supported on Version 7 or BSD versions.

# [AUTHORS](#AUTHORS)

Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S. Raymond.

# [SEE ALSO](#SEE_ALSO)

[**curses**(3X)](/man/os/ncurses/curses.3X), [**menu**(3X)](/man/os/ncurses/menu.3X)

2024-12-28 ncurses 6.6

---

Document: set_item_init(3x) from ncurses 6.6.20261024-r0 (Chainguard OS)
Source: https://github.com/ThomasDickey/ncurses-snapshots
