RE: Signal of a button dynamically created
- From: Jon Zabala Gutiérrez <judixzg hotmail com>
- To: "gtk-app-devel-list gnome org" <gtk-app-devel-list gnome org>
- Subject: RE: Signal of a button dynamically created
- Date: Mon, 28 Oct 2013 16:40:27 +0100
I think the best thing you can do is associate a number when you connect the button response to a method like
this:
my_button.signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &my_class::OnMyButtonClicked),iNumber));
The only thing you have to take into account is that the response method changes from the standard one.
If the method to be associated to a click event of a button is the following:
void on_my_clicked()
When you use sigc::bind the method changes and it should be like this
void OnMyButtonClicked(int x)
I hope this helps you,
Kind regards,
Jon Zabala
Date: Mon, 28 Oct 2013 17:29:18 +0200
From: fr33domlover mailoo org
To: gtk-app-devel-list gnome org
Subject: Re: Signal of a button dynamically created
I'm not experienced but here's a quick idea:
Create a new derived Button class which handles its own click by
overriding the virtual method, and in that method it emits a signal
which passes the button ID/row number as a parameter. Then listen to
this signal from all buttons :-)
:כתב Borja Mon Serrano, 2013-10-28 17:22 בתאריך
Hi,
I'm building a popup window that has a Gtk::Grid inside it. The first row
has a form with three Gtk::Entry and a button to add the information to the
program. The rest of the rows has the items created before in that way
(just with Gtk::Label) and a button to remove the information. Like this:
|--------------------------------------------------------------------------------------|
| Gtk::Entry | Gtk::Entry | Gtk::Entry | Gtk::Button (add) |
|--------------------------------------------------------------------------------------|
|----------------------- rows dynamically added --------------------------|
| Gtk::Label | Gtk::Label | Gtk::Label | Gtk::Button (remove) |
|--------------------------------------------------------------------------------------|
| Gtk::Label | Gtk::Label | Gtk::Label | Gtk::Button (remove) |
|--------------------------------------------------------------------------------------|
| Gtk::Label | Gtk::Label | Gtk::Label | Gtk::Button (remove) |
|--------------------------------------------------------------------------------------|
...
The point here is: how can I know what button was pressed in order to
remove a row?
Thanks! :)
Borja.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list [1]
Links:
------
[1] https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]