Re: remove a toolbar icon




On Dec 30, 2005, at 9:16 AM, Dave M wrote:

It's easy enough to add additional icons/elements to a toolbar using
the $toolbar->insert_stock(...). But is there a way to remove an
element? I have a toolbar which adds an element to the toolbar given a
certain action. I'd like to be able to remove it later as well. I
noticed there's a $toolbar->remove_space($position), but this won't
affect non-spaces.

A Gtk2::Toolbar isa Gtk2::Container, so Gtk2::Container's remove() method should do the trick.

If it's a common need for your toolbar contents to change based on program actions, you may actually be wanting to use the Gtk2::UIManager, instead. This widget allows you to define sets of actions, and merge these into and out of the UI dynamically. And the action-based menus and toolbars are nicer to use, anyway. ;-)


--
Without treatment, a common cold will last about seven days.
With treatment, it will last about a week.
  -- conventional wisdom




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]