On 11/05/13 04:31, Kjell Ahlstedt wrote:
> When you connect to signal_button_press_event() with
>
>    m_textviewPlaylists->signal_button_press_event().connect(
>      sigc::mem_fun(*this, &Main_win::on_button_Pressed) );
>
> the second parameter in connect() gets its default value, after == true, 
> meaning that your signal handler is called after the default signal 
> handler. If the default signal handler returns true, your signal handler 
> is not called. You can connect your signal handler before the default 
> signal handler with
>
>    m_textviewPlaylists->signal_button_press_event().connect(
>      sigc::mem_fun(*this, &Main_win::on_button_Pressed), false );
>
> A section in the gtkmm tutorial describes this peculiarity of X event 
thank you very much that worked
> signals:
> https://developer.gnome.org/gtkmm-tutorial/stable/sec-xeventsignals.html.en
>
> Kjell
>
> 2013-05-10 18:57, Francis (Grizzly) Smit skrev:
>> On 11/05/13 02:08, Francis (Grizzly) Smit wrote:
>>> hi I have been trying to catch mouseclick events in a Gtk::TextView
>>>
>>> I have tried
>>>
>>>      m_builder->get_widget("textviewPlaylists", m_textviewPlaylists);
>>>      if(m_textviewPlaylists){
>>>          //m_textviewPlaylists->signal_clicked().connect(
>>> sigc::mem_fun(*this, &Main_win::on_button_Connect) );
>>>          //m_textviewPlaylists->signal_clicked().connect(
>>> sigc::mem_fun(*this, &Main_win::on_button_Connect) );
>>>          m_textviewPlaylists->property_events() =
>>> m_textviewPlaylists->property_events() | Gdk::BUTTON_PRESS_MASK;
>>>          m_textviewPlaylists->signal_button_press_event().connect(
>>> sigc::mem_fun(*this, &Main_win::on_button_Pressed) );
>>>          //Glib::RefPtr<Gtk::TextBuffer> buffer =
>>> m_textviewPlaylists->get_buffer();
>>>          //buffer->signal_button_press_event().connect(
>>> sigc::mem_fun(*this, &Main_win::on_button_Pressed) );
>>>      }
>>>
>>> where m_textviewPlaylists is a pointer to my Gtk::TextView object no
>>> luck I have also tried
>>>
>>>      m_builder->get_widget("scrolledwindowPlaylists",
>>> m_scrolledwindowPlaylists);
>>>      if(m_scrolledwindowPlaylists){
>>>          m_scrolledwindowPlaylists->property_events() =
>>> Gdk::BUTTON_PRESS_MASK;
>>>          m_scrolledwindowPlaylists->signal_button_press_event().connect(
>>> sigc::mem_fun(*this, &Main_win::on_button_Pressed) );
>>>      }
>>>
>>>   where m_scrolledwindowPlaylists is a pointer to a Gtk::ScrolledWindow
>>> containing the said Gtk::TextView no luck with this either.
>>>
>>> the event does not fire either way
>>>
>>> my handler looks like so
>>>
>>>
>>> bool Main_win::on_button_Pressed(GdkEventButton* event){
>>>      std::cout << "entering on_button_Pressed" << std::endl;
>>>      if(event->type == GDK_2BUTTON_PRESS){ //double click //
>>>          std::cout << "double click" << std::endl;
>>>          return true;
>>>      }else if(event->type == GDK_BUTTON_PRESS){ // single click //
>>>          std::cout << "single click" << std::endl;
>>>          return true;
>>>      }
>>>      return false;
>>> }
>>>
>>>
>>> any help with this would be greatly appreciated, thanks in advance.
>>>
>>>
>> Oh incase it's relevant I am using anjuta and glade
>>


-- 


  .~.     In my life God comes first.... 
  /V\         but Linux is pretty high after that :-D
 /( )\    Francis (Grizzly) Smit
 ^^-^^    http://www.smit.id.au/

_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to