connect_notify()



Hello,

I want a context menu to popup when the user right-clicks on a tree view. So I looked up signal_button_press_event() and I was told to either derive my own view from TreeView (I don't want that) and override the default handler, or use connect_notify() instead. Well, what does this mysterious function do? Googling for it turned out that it has something to do with coverting non-void return types to void return types of the signal handler (though I don't understand why this is needed at all).

Anyway, if I use this function to connect my own signal handler (as usual with sigc::mem_fun), the compiler complains about mismatching return types (the errors message is pretty long-winded, STL style, you don't want to see it I guess...). Instead of posting the error message from g++, here's the code which caused it:

// m_view is a TreeView

m_view.signal_button_press_event().connect_notify( sigc::mem_fun( *this, &FileBrowser::on_rmb_clicked ) );

// ...

void FileBrowser::on_rmb_clicked()
{
   // ...
}

I don't get what's wrong here.

--
Matthias Kaeppler




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]