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 GUIAdjazenzmatr ix::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(*p Button, j, j+1, i, i+1);
pButton->signal_clicked ().connect(sigc ::bind<int, int>
(sigc::mem_fun( *this,
&GUIAdjazenzmat rix::onButtonCl ick), j, i));
}
}
}
void GUIAdjazenzmatr ix::onButtonCli ck(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 GUIAdjazenzmatr ix::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(*p Button, j, j+1, i, i+1);
pButton->signal_clicked ().connect(sigc ::bind<int, int,
Gtk::Button*>
(sigc::mem_fun( *this,
&GUIAdjazenzmat rix::onButtonCl ick), 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_f unctor<T_functo r>::deduce_resu lt_type<T_arg1, T_arg2,
T_arg3, void, void, void, void>::type
sigc::adaptor_f unctor<T_functo r>::operator()( T_arg1, T_arg2, T_arg3)
const [with T_arg1 = int&, T_arg2 = int&, T_arg3 = Gtk::Button*&,
T_functor = sigc::bound_mem _functor2<void, GUIAdjazenzmatr ix, int, int>]«:
/usr/include/sigc++-2.0/sigc++/adaptors/bind.h:1511: instantiated from
»typename sigc::adapts<T_ functor>::adapt or_type::result _type
sigc::bind_func tor<-0x000000001, T_functor, T_type1, T_type2, T_type3,
sigc::nil, sigc::nil, sigc::nil, sigc::nil>::ope rator()() [with
T_functor = sigc::bound_mem _functor2<void, GUIAdjazenzmatr ix, 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_f unctor,
T_return>::call _it(sigc::inter nal::slot_rep*) [with T_functor =
sigc::bind_func tor<-0x000000001, sigc::bound_mem _functor2<void,
GUIAdjazenzmatr ix, 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_f unctor,
T_return>::addr ess())(void*) [with T_functor =
sigc::bind_func tor<-0x000000001, sigc::bound_mem _functor2<void,
GUIAdjazenzmatr ix, 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_func tor<-0x000000001, sigc::bound_mem _functor2<void,
GUIAdjazenzmatr ix, 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_r eturn, sigc::nil, sigc::nil, sigc::nil, sigc::nil,
sigc::nil, sigc::nil, sigc::nil>::slo t(const T_functor&) [with T_functor
= sigc::bind_func tor<-0x000000001, sigc::bound_mem _functor2<void,
GUIAdjazenzmatr ix, int, int>, int, int, Gtk::Button*, sigc::nil,
sigc::nil, sigc::nil, sigc::nil>, T_return = void]«
GUIAdjazenzmatr ix.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 2 2627
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 GUIAdjazenzmatr ix::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(*p Button, j, j+1, i, i+1);
pButton->signal_clicked ().connect(sigc ::bind<int, int>
(sigc::mem_fun( *this,
&GUIAdjazenzmat rix::onButtonCl ick), j, i));
}
}
}
void GUIAdjazenzmatr ix::onButtonCli ck(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 GUIAdjazenzmatr ix::createTable () {
[...]
pButton->signal_clicked ().connect(sigc ::bind<int, int,
Gtk::Button*>
(sigc::mem_fun( *this,
&GUIAdjazenzmat rix::onButtonCl ick), 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 GUIAdjazenzmatr ix::onButtonCli ck 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
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
Templateargumen tliste", 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 GUIAdjazenzmatr ix::onButtonCli ck 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.d evelopment.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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 following
error message:
checking for pkg-config... /usr/bin/pkg-config
Package gtkmm-2.0 was not found in the pkg-config path.
|
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.6.9 and the GTKmm
(for Windows) from http://www.pcpm.ucl.ac.be/~gustin/win32_ports/ is at
version 2.6.2-1. Now the problem is not that I just want to develop
using
the GTKmm library, but I also have applications such as DIA and GIMP,
which I use...
|
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 as a blessing when "Sams Teach Yourself GTK+ Programming in 21
Days" was put on the bookstores' shelves in the year 2000. I remember
having to line up at the teller and noticing that two out of five
people had this book in their baskets or under...
|
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. It should be
able to show
- graphs
- contents of textfiles
- images (ppm or whatever)
- radio buttons, etc (user input elements)
|
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.
| |
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 how to handle those exceptions. Is implicit exception throwing possible in gtkmm or should we throw the exceptions explicitly using "throw" statement ? and what is the exception class hierarchy in gtkmm?. If possible, please send me example program.
...
|
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 installed the required package for gtkmm namely ,
libgtkmm-2.4-dev
by running apt-get install libgtkmm-2.4-dev as root
after that , i tried running the folowing code :
|
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 match for call to `(sigc::bound_mem_functor0<bool, jv+e::Entry>)
(GdkEventFocus* const&)'
I using Gtkmm 2.10.x for Windows
Thanks in advance!
|
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 signal but
doesn't seem to change the state of the object.
Example Code Below:
http://www.nylxs.com/docs/workshops/toogle.cc
http://www.nylxs.com/docs/workshops/toogle.cc.html
http://www.nylxs.com/docs/workshops/toogle.h...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |