[Xfc-dev] Signal-handling-question
Johannes Zellner
webmaster at nebulon.de
Tue Jul 26 09:05:26 CEST 2005
Oh sorry for bad description, but this isn't my problem.
I simply can't connect any signals descripted in the widget class
(like for example signal_key_release_event()) with my Gtk::Entry .
Probably I missunderstood the API, but I can't find the right way.
If I connnect signals descripted in the Gtk::Entry class I have no
problem with this code:
[...]
entry->signal_activate().connect(sigc::mem_fun(this, &FileStepper::go));
[...]
void FileStepper::go();
....
So, is it not possible to add widget-events to a Gtk::Entry ?
Bye
Johannes
Jeff Franks schrieb:
>Johannes Zellner wrote:
>
>
>
>>Hi
>>
>>I started to write a small application with the foundation-classes, now
>>I've a question:
>>How can I connect the key_release_signal to a Entry-Widget ?
>>
>>I tried it like:
>>
>>entry->signal_key_release_event().connect(sigc::mem_fun(this,
>>&FileStepper::gofor));
>>
>>.....
>>
>>
>>bool gofor(Gdk::EventCrossing& event)
>>{
>>....
>>}
>>
>>But I get many confusin errors by compiling.
>>
>>Would be nice if someone could just post a example :-)
>>
>>
>>
>>
>>
>Johannes,
>
>I don't know if this is your problem but the example code above is
>wrong. FileStepper::gofor() is declared as a class member function but
>it's defined as a global function. You shouldn't use global functions in
>C++ if you can avoid it, but if you did, the above code should look like
>this:
>
>entry->signal_key_release_event().connect(sigc::ptr_fun(&gofor));
>
>bool gofor(Gdk::EventCrossing& event)
>{
>....
>}
>
>and for a member function the code should look like this:
>
>entry->signal_key_release_event().connect(sigc::mem_fun(this,
>&FileStepper::gofor));
>
>bool FileStepper::gofor(Gdk::EventCrossing& event)
>{
>....
>}
>
>I presume "this" is a FileStepper instance. If not, "this" should point
>to the class the gofor() function is declared in.
>
>Jeff.
>
>_______________________________________________
>Xfc-dev mailing list
>Xfc-dev at xfce.org
>http://foo-projects.org/mailman/listinfo/xfc-dev
>
>
>
More information about the Xfc-dev
mailing list