Thread: syntax help : m_button.signal_clicked().connect(sigc:...

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    3

    syntax help : m_button.signal_clicked().connect(sigc:...

    Hi.

    Will someone educate me on the correct terms/words for the following syntax so I can google for more info.

    Code:
    ().connect(
    in:

    Code:
    m_button.signal_clicked().connect(sigc::mem_fun(*this,&HelloWorld::on_button_clicked));
    I understand what this does, establish the connection. But a reference to a guide with some examples and explanations on the syntax would be great.

    thx

  2. #2
    Registered User
    Join Date
    Apr 2009
    Posts
    3
    Code:
    m_button.signal_clicked()
    This means: call member function signal_clicked() of class m_button.

    signal_clicked() returns an object of a class with a memberfunction named connect(). Is that correct? If I'm right about that, then is there a name for this syntax? I would like to read more about this syntax.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Mannic
    This means: call member function signal_clicked() of class m_button.
    Almost, except that m_button is an object, not a class.

    Quote Originally Posted by Mannic
    signal_clicked() returns an object of a class with a memberfunction named connect(). Is that correct?
    Yes.

    Quote Originally Posted by Mannic
    If I'm right about that, then is there a name for this syntax?
    I call it function (or function call) chaining.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    Apr 2009
    Posts
    3
    Thanks, exactly what I needed.

    I found an example here. Easy to understand, and just as expected.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM