Re: Gtk::Entry Icon



On Fri, 2011-03-18 at 07:44 +0000, Andrew wrote:
> On 18/03/11 07:37, Andrew wrote:
> > On 17/03/11 18:57, Krzesimir Nowak wrote:
> >> 2011/3/17 Andrew <rugby471 gmail com>:
> >>> Hi,
> >>>
> >>> I have a Gtk::Entry that has an icon at the end
> >>> (Gtk::ENTRY_ICON_SECONDARY) and I set it to be Gtk::Stock::CLEAR
> >>>
> >>> Now I want to remove this icon. In C, I do this by passing NULL to
> >>> gtk_entry_set_icon_from_stock(). Reading the documentation at [1], I
> >>> gather that I should pass zero to achieve this same effect. However when
> >>> I do this, I receive the error:
> >>>
> >>> [Code]
> >>> set_icon_from_stock(0, Gtk::ENTRY_ICON_SECONDARY);
> >>>
> >>> [Error]
> >>> ui/dialog/ocaldialogs.cpp: In constructor
> >>> ‘Inkscape::UI::Dialog::OCAL::SearchEntry::SearchEntry(Glib::ustring)’:
> >>>
> >>> ui/dialog/ocaldialogs.cpp:292: error: no matching function for call to
> >>> ‘Inkscape::UI::Dialog::OCAL::SearchEntry::set_icon_from_stock(int,
> >>> Gtk::EntryIconPosition)’
> >>>
> >>> /usr/include/gtkmm-2.4/gtkmm/entry.h:625: note: candidates are: void
> >>> Gtk::Entry::set_icon_from_stock(const Gtk::StockID&, Gtk::EntryIconPosition)
> >>>
> >>>
> >>> How can I achieve this in gtkmm?
> >>>
> >>
> >> Use Gtk::Entry::unset_icon(Gtk::EntryIconPosition).
> 
>  Sorry, but when I use that I get (correct error message this time):
> 
>  error: ‘unset_icon’ was not declared in this scope

Sorry, yes that seems to be in the (unstable) gtkmm 3 only. It's not in
gtkmm-2.24 (the latest and probably last of the 2.x series).

However, you can work around it by doing this:
  gtk_entry_set_icon_from_stock(entry.gobj(), 0);


-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



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