Gtk2::OptionMenu(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

πŸ’– Gtk2::OptionMenu β€” ok bestie, sit down, we need to talk πŸ’–

So this is Gtk2::OptionMenu, the Perl wrapper for GtkOptionMenu. It's giving "your older cousin's widget" β€” iconic in its day, and now… well. Keep reading. πŸ™ˆ


🌸 HIERARCHY 🌸

Here's the family tree, and yes she comes from a long line of ancestors:

  Glib::Object
  +----Glib::InitiallyUnowned
       +----Gtk2::Object
            +----Gtk2::Widget
                 +----Gtk2::Container
                      +----Gtk2::Bin
                           +----Gtk2::Button
                                +----Gtk2::OptionMenu

Six levels deep just to get a dropdown, the way that Gtk2 does. Periodt. πŸ’…


✨ INTERFACES ✨

She also collects these like friendship bracelets:

  Glib::Object::_Unregistered::AtkImplementorIface
  Gtk2::Buildable
  Gtk2::Activatable

πŸ’€ DEPRECATION WARNING πŸ’€

Gtk2::OptionMenu has been marked as deprecated, and should not be used in newly written code.

Not me being the bearer of bad news 😭 β€” but fr fr, do not build new stuff on this one.

The glow-up you actually want is Gtk2::ComboBox. Use that instead of Gtk2::OptionMenu. That's the whole vibe check. 🫢


πŸŽ€ METHODS πŸŽ€

widget = Gtk2::OptionMenu->new

Makes you a brand new option menu. Classic constructor energy. ⭐

integer = $option_menu->get_history

Hands you back the current history value as an integer. πŸ‘‘

$option_menu->set_history ($index)

Sets the history to whatever index you pass in.

  • $index (integer)

widget = $option_menu->get_menu

Gives you the menu widget back. πŸ¦‹

$option_menu->set_menu ($menu)

Swaps in a whole new menu.

  • $menu (Gtk2::Widget)

$option_menu->remove_menu

Yeets the menu right outta there. Bye bestie πŸ‘‹


πŸ“ PROPERTIES πŸ“

  • 'menu' (Gtk2::Menu : default undef : readable / writable / private / static-nick / static-blurb) β€” The menu of options

🌈 STYLE PROPERTIES 🌈

  • 'indicator-size' (Gtk2::Requisition : default undef : readable / private / static-nick / static-blurb) β€” Size of dropdown indicator
  • 'indicator-spacing' (Gtk2::Border : default undef : readable / private / static-nick / static-blurb) β€” Spacing around indicator

πŸ”₯ SIGNALS πŸ”₯

  • changed (Gtk2::OptionMenu)

That's it, that's the signal. She's lowkey minimal like that. πŸ’œ


πŸ‘€ SEE ALSO πŸ‘€

Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container, Gtk2::Bin, Gtk2::Button

Basically the whole friend group. Go say hi. 🌸


Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice.


Okay that's the whole page, bestie β€” you ate that πŸ’… This lil slice of documentation came from the User Contributed Perl Documentation for Gtk2::OptionMenu(3), and it was baked with perl v5.42.0 back on 2025-07-25. Stan a classic, but go use Gtk2::ComboBox fr fr 🫢✨

πŸ“¦ where this page comes from