Re: [gtkmm] TreeView && Popup Menu



Marcel Karras wrote:

It doesn't make any differences to me:

---
treeview.signal_button_release_event().connect_notify(
 SigC::slot(*this, &RedFilesDialog::on_treeview_click));
---

The function:

---
void RedFilesDialog::on_treeview_click(GdkEventButton *_pButtonEvent)
{
 if( _pButtonEvent->type == GDK_BUTTON_RELEASE &&
     _pButtonEvent->button == 3 )
 {
   std::cout << "popup" << std::endl;
 }
}
---

"popup" appears correct on right-click but the toggle widget will toggle
anyways.

Everything should be clear if you'd read tutorial carefully:
...
<widget>.signal_button_press_event ().connect (<slot>, false); // not release! cuz press gonna toggle checkbox
...

bool <slot>  (event)
{
   if (event->button == 3)
   {
       <popup>
       return true; // stop signal
   }
   return false; // continue signal processing
}

If this question wasn't mentioned in FAQ yet, guess, it is time for it.

Regards,
-andrew





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