[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtkmm
Subject:    Re: how to set a callback function to an icon in an entry ?
From:       Jonas Platte <jonasplatte () gmail ! com>
Date:       2015-01-22 13:20:10
Message-ID: 54C0F90A.60709 () gmail ! com
[Download RAW message or body]

Looking at the documentation for GdkEventButton [1], it seems like it
lets you detect whether the icon was only clicked once, double-clicked
or activated in another way. If you only want a simple click handler, I
assume you can ignore the parameter, or if you want a bit cleaner code,
leave the parameter out of your method declaration entirely and use
sigc::hide [2] to make your functor compatible to the signal, e.g.:

  void MyClass::on_icon_release(Gtk::EntryIconPosition icon_position)
  {
    [...]
  }

  MyClass::MyClass
  {
    [...]

  entry->signal_icon_release().connect(sigc::hide<1>(
    sigc::mem_fun(this, &MyClass::on_icon_release)));
  }


[1]
https://developer.gnome.org/gdk3/stable/gdk3-Event-Structures.html#GdkEvent=
Button

[2] https://developer.gnome.org/libsigc++/stable/group__hide.html

Am 22.01.2015 um 05:30 schrieb Nicolas J=E4ger:
> Hi,
> =

> On Thu, 22 Jan 2015 02:23:30 +0100
> Jonas Platte <jonasplatte@gmail.com> wrote:
> =

>> There are the methods signal_icon_press() and signal_icon_release()
>> [1] in Gtk::Entry (assuming that's what you're talking about). I
>> think you should be able to connect to one or both of them to create
>> a functioning "(secondary) icon clicked handler".
>>
>> [1]
>> https://developer.gnome.org/gtkmm/stable/classGtk_1_1Entry.html#ad39f745=
e170882bc165f962cce80e578
>>
> that's exactly what I was looking for, thx. I have a question about the
> calback functions of these methods. The calback function need a
> =

> const GdkEventButton*
> =

> parameter. What is this ?
> =

> regards,
> /nicoo
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtkmm-list
> =


_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic