473,378 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Changing a gtkmm label through a signal possible?

Hello,

I have a window containing a table with some (dynamically created)
buttons. I want to change the buttons, when they are clicked, but with
dynamically created buttons, this issue seems to be not that easy.
Look at this methods:
void GUIAdjazenzmatrix::createTable() {

for(int i = 0; i < knotenAnzahl; i++) {
for(int j = 0; j < knotenAnzahl; j++) {
Gtk::Button* pButton = Gtk::manage(new Gtk::Button(" 0 "));
table.attach(*pButton, j, j+1, i, i+1);

pButton->signal_clicked().connect(sigc::bind<int, int>
(sigc::mem_fun(*this,
&GUIAdjazenzmatrix::onButtonClick), j, i));
}
}
}

void GUIAdjazenzmatrix::onButtonClick(int j, int i) {

//some code

}

I tried to force a Gtk::Button pointer through this signal, but I
couldn't manage it.
When I try something like this:

void GUIAdjazenzmatrix::createTable() {

for(int i = 0; i < knotenAnzahl; i++) {
for(int j = 0; j < knotenAnzahl; j++) {
Gtk::Button* pButton = Gtk::manage(new Gtk::Button(" 0 "));
table.attach(*pButton, j, j+1, i, i+1);

pButton->signal_clicked().connect(sigc::bind<int, int,
Gtk::Button*>
(sigc::mem_fun(*this,
&GUIAdjazenzmatrix::onButtonClick), j, i, pButton));
}
}
}

...I get these errors:
$ g++ GUI*.cpp Main.cpp -o Main `pkg-config gtkmm-2.4 --libs --cflags`
/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h: In member
function »typename
sigc::adaptor_functor<T_functor>::deduce_result_ty pe<T_arg1, T_arg2,
T_arg3, void, void, void, void>::type
sigc::adaptor_functor<T_functor>::operator()(T_arg 1, T_arg2, T_arg3)
const [with T_arg1 = int&, T_arg2 = int&, T_arg3 = Gtk::Button*&,
T_functor = sigc::bound_mem_functor2<void, GUIAdjazenzmatrix, int, int>]«:
/usr/include/sigc++-2.0/sigc++/adaptors/bind.h:1511: instantiated from
»typename sigc::adapts<T_functor>::adaptor_type::result_type
sigc::bind_functor<-0x000000001, T_functor, T_type1, T_type2, T_type3,
sigc::nil, sigc::nil, sigc::nil, sigc::nil>::operator()() [with
T_functor = sigc::bound_mem_functor2<void, GUIAdjazenzmatrix, int, int>,
T_type1 = int, T_type2 = int, T_type3 = Gtk::Button*]«
/usr/include/sigc++-2.0/sigc++/functors/slot.h:103: instantiated from
»static T_return sigc::internal::slot_call0<T_functor,
T_return>::call_it(sigc::internal::slot_rep*) [with T_functor =
sigc::bind_functor<-0x000000001, sigc::bound_mem_functor2<void,
GUIAdjazenzmatrix, int, int>, int, int, Gtk::Button*, sigc::nil,
sigc::nil, sigc::nil, sigc::nil>, T_return = void]«
/usr/include/sigc++-2.0/sigc++/functors/slot.h:110: instantiated from
»static void* (* sigc::internal::slot_call0<T_functor,
T_return>::address())(void*) [with T_functor =
sigc::bind_functor<-0x000000001, sigc::bound_mem_functor2<void,
GUIAdjazenzmatrix, int, int>, int, int, Gtk::Button*, sigc::nil,
sigc::nil, sigc::nil, sigc::nil>, T_return = void]«
/usr/include/sigc++-2.0/sigc++/functors/slot.h:454: instantiated from
»sigc::slot0<T_return>::slot0(const T_functor&) [with T_functor =
sigc::bind_functor<-0x000000001, sigc::bound_mem_functor2<void,
GUIAdjazenzmatrix, int, int>, int, int, Gtk::Button*, sigc::nil,
sigc::nil, sigc::nil, sigc::nil>, T_return = void]«
/usr/include/sigc++-2.0/sigc++/functors/slot.h:1130: instantiated from
»sigc::slot<T_return, sigc::nil, sigc::nil, sigc::nil, sigc::nil,
sigc::nil, sigc::nil, sigc::nil>::slot(const T_functor&) [with T_functor
= sigc::bind_functor<-0x000000001, sigc::bound_mem_functor2<void,
GUIAdjazenzmatrix, int, int>, int, int, Gtk::Button*, sigc::nil,
sigc::nil, sigc::nil, sigc::nil>, T_return = void]«
GUIAdjazenzmatrix.cpp:27: instantiated from here
/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:123: Fehler:

....and so on..

What can i do?
Markus
Jul 3 '07 #1
2 2580
Markus Pitha wrote:
I have a window containing a table with some (dynamically created)
buttons. I want to change the buttons, when they are clicked, but with
dynamically created buttons, this issue seems to be not that easy.
Look at this methods:
void GUIAdjazenzmatrix::createTable() {

for(int i = 0; i < knotenAnzahl; i++) {
for(int j = 0; j < knotenAnzahl; j++) {
Gtk::Button* pButton = Gtk::manage(new Gtk::Button(" 0 "));
table.attach(*pButton, j, j+1, i, i+1);

pButton->signal_clicked().connect(sigc::bind<int, int>
(sigc::mem_fun(*this,
&GUIAdjazenzmatrix::onButtonClick), j, i));
}
}
}

void GUIAdjazenzmatrix::onButtonClick(int j, int i) {
[...]
I tried to force a Gtk::Button pointer through this signal, but I
couldn't manage it.
When I try something like this:

void GUIAdjazenzmatrix::createTable() {
[...]
pButton->signal_clicked().connect(sigc::bind<int, int,
Gtk::Button*>
(sigc::mem_fun(*this,
&GUIAdjazenzmatrix::onButtonClick), j, i, pButton));
}
}
}

..I get these errors:
[...]

Sorry, not enough information.
I think you snipped just before the important part of the error message.

Some questions:
1) Did you read the error messages?
2) Did you change GUIAdjazenzmatrix::onButtonClick also?
3) Did you change the signature of onButtonClick in the class declaration?
4) Did you ask in a place where the GTK library is on-topic?

Read here:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

--
Thomas
http://www.netmeister.org/news/learn2quote.html
Jul 3 '07 #2
Thomas J. Gritzan wrote:
Sorry, not enough information.
I think you snipped just before the important part of the error message.
I didn't post it because I just wanted to demonstrate which errors
appear. Sometime I also get a "Fehler: Syntaxfehler in
Templateargumentliste", depending on my tries.
When I check out
http://libsigc.sourceforge.net/libsi...oup__bind.html
there are a lot of adaptors with different amounts of undefined types,
so how does it come that my 3-argument-expression does not fit.
Some questions:
1) Did you read the error messages?
Yes, and with this link above I tried to find a solution. Unfortunately,
I don't know what these "nil"s in the parameter list are.

2) Did you change GUIAdjazenzmatrix::onButtonClick also?
Sure, but then I only changed just the first method over and over again.
If there are no errors anymore I concentrate on the second method.
3) Did you change the signature of onButtonClick in the class declaration?
I don't exactly know what you mean now?
4) Did you ask in a place where the GTK library is on-topic?
I think my question is probably more a c++ problem than a gtk problem.
Moreover there are no gtk groups. There is indeed
comp.os.linux.development.apps but this group gets only few hits a day
apart from the fact that it's no gtk group either.
But if you recommend one to my I would be glad.

Markus
Jul 3 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Lars Weber | last post by:
Hi! I am trying out some C++ programmig with my Gentoo Linux distribution. When I generate a Gtkmm project with the Anjuta IDE wizard and just push the "Run configure" button, I end up with the...
1
by: Al-Burak | last post by:
I have been tinkering around the GTK world for a while, and since I am more of a C++ programmer I would like to use GTKmm to develop my GUI. However, I have a GTK+ (from Tor Lillqvist) version...
2
by: Al-Burak | last post by:
Ever since I started tinkering around the GTK+ and later on Gtkmm toolkits, I've noticed a steady flow of programmers talking more and more, and more passionately, about these toolkits. It came...
24
by: silversurfer2025 | last post by:
Hello. I do not know whether this really is the right group, but I could not find any group dealing only with GUIs for C++ so here I am. I am currently deciding which GUI to use in my program....
0
by: rsaikamesh | last post by:
Hi, I im creating GUI in c++ using gtkmm (OS - ubuntu). I want to add a CheckMenuItem in a menubar.I dont know how to add this.please tell me, how to add this.if possible please send me the coding.
0
by: paridaG | last post by:
Hi, I am using gtkmm 2.4 to create user interface in my application.My OS is ubuntu. Now i am doing error logging in my application. I do not know, What are the exceptions may occur in gtkmm and...
0
rhitam30111985
by: rhitam30111985 | last post by:
Hi everyone , dunno whether to post this in linux forum or c/c++ forum.. I am trying to create GUI files using gtkmm library in c++ . I am using debian linux with GNOME desktop environment . i...
2
by: jalqadir | last post by:
I would like to add a signal to a Gtk::Entry object, but for some reason this gives me bunch of errors saying that it is D:\XWin\include\sigc++-2.0\sigc++\adaptors\adaptor_trait.h|84|error: no...
2
by: Ruben | last post by:
It seems to me that the togglebutton toggled() function has a but. Documentation says that when called it will change the state of the object. I can't varify this behavior. It calls the toogle...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.