---
name: "Tk_AddOption"
section: "3tk"
platform: "linux"
package: "tk8.6-doc"
version: "8.6.16-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Tk_AddOption/3tk"
---

# Tk\_AddOption(3tk)

Add an option to the option database

```

```

## NAME

Tk\_AddOption - Add an option to the option database

## SYNOPSIS

```
#include <tk.h>

void
Tk_AddOption(tkwin, name, value, priority)
```

## ARGUMENTS

- Tk\_Window *tkwin* (in)

  Token for window.

- const char *\*name* (in)

  Multi-element name of option.

- const char *\*value* (in)

  Value of option.

- int *priority* (in)

  Overall priority level to use for option.

  ```

  ```

## DESCRIPTION

This procedure is invoked to add an option to the database associated with *tkwin*'s main window.  *Name* contains the option being specified and consists of names and/or classes separated by asterisks or dots, in the usual X format. *Value* contains the text string to associate with *name*; this value will be returned in calls to **Tk\_GetOption**. *Priority* specifies the priority of the value; when options are queried using **Tk\_GetOption**, the value with the highest priority is returned.  *Priority* must be between 0 and **TK\_MAX\_PRIO** (100). Some common priority values are:

- **TK\_WIDGET\_DEFAULT\_PRIO**

  Used for default values hard-coded into widgets.

- **TK\_STARTUP\_FILE\_PRIO**

  Used for options specified in application-specific startup files.

- **TK\_USER\_DEFAULT\_PRIO**

  Used for options specified in user-specific defaults files, such as **.Xdefaults**, resource databases loaded into the X server, or user-specific startup files.

- **TK\_INTERACTIVE\_PRIO**

  Used for options specified interactively after the application starts running.

## KEYWORDS

class, name, option, add
