Tk_AddOption(3)

πŸ’– Tk_AddOption πŸ’–

okay so bestie, this is the Tk_AddOption(3) page from the Tk Library Procedures manual β€” aka the official glow-up guide for adding options to the option database. it’s giving very β€œI know my X resources” energy. πŸ’…


🌸 NAME 🌸

Tk_AddOption β€” add an option to the option database. lowkey iconic, no cap.


✨ SYNOPSIS ✨

#include <tk.h>

void
Tk_AddOption(tkwin, name, value, priority)

Tcl_Obj *
Tk_GetSystemDefault(tkwin, dbName, className)

πŸŽ€ ARGUMENTS πŸŽ€

  • Tk_Window tkwin (in) β€” token for window. yes bestie, it’s the window token.
  • const char *name (in) β€” multi-element name of option.
  • const char *value (in) β€” value of option.
  • const char *dbName (in) β€” the option database name.
  • const char *className (in) β€” the name of the option class.
  • int priority (in) β€” overall priority level to use for option.

πŸ¦‹ DESCRIPTION πŸ¦‹

Tk_AddOption gets invoked to add an option to the database associated with tkwin’s main window. Name contains the option being specified, and it consists of names and/or classes separated by asterisks or dots, in the usual X format. periodt.

Value contains the text string to associate with name; this value will be returned in calls to Tk_GetOption. so yes, it’s the little payload that comes back later. 🫢

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) β€” that’s the range, bestie, no extra credit for going outside it. 😭

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.

Tk_GetSystemDefault returns a Tcl_Obj * with the string identifying a configuration option matching the given dbname and className. Returns NULL if there are no system defaults that match this pair. so if it’s a no-match situation, you get NULL β€” that’s the vibe check result. πŸ’€


πŸ‘‘ KEYWORDS πŸ‘‘

class, name, option, add


πŸ’– xoxo, your Tk manual bestie β€” source/version: Tk, manual page: Tk_AddOption(3), date: not printed on this page. periodt. πŸŽ€

πŸ“¦ where this page comes from