GTK+ 2.0 with C++

This is a discussion on GTK+ 2.0 with C++ within the Linux Programming forums, part of the Platform Specific Boards category; I've noticed that g_signal_connect() refuses to take functions declared in classes as the callback argument. Is there a way to ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    29

    GTK+ 2.0 with C++

    I've noticed that g_signal_connect() refuses to take functions declared in classes as the callback argument. Is there a way to get around this?

    Thanks

    Skarr

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    Since functions are per instance, you need to create a static function. This static function can take 'this' as an argument and then call this->function_you_want_it_to_call, if that works (I havn't looked at the functin you are asking about). But because the function you are askig it to use is part of an INSTANCE variable, you cannot pass it as a callback function.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 09-22-2008, 04:49 AM
  2. Compile to 1.1 got 2.0
    By Coder87C in forum Windows Programming
    Replies: 0
    Last Post: 04-19-2006, 03:13 AM
  3. Replies: 1
    Last Post: 10-24-2005, 06:35 AM
  4. Gtk
    By curlious in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 01-01-2005, 11:05 AM
  5. QT or GTK
    By mart_man00 in forum Linux Programming
    Replies: 4
    Last Post: 03-24-2003, 09:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21