Re: catching mouse click events in a Gtk::TextView

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);
sigc::mem_fun(*this, &Main_win::on_button_Connect) );
sigc::mem_fun(*this, &Main_win::on_button_Connect) );
        m_textviewPlaylists->property_events() =
m_textviewPlaylists->property_events() | Gdk::BUTTON_PRESS_MASK;
sigc::mem_fun(*this, &Main_win::on_button_Pressed) );
        //Glib::RefPtr<Gtk::TextBuffer> buffer =
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_scrolledwindowPlaylists->property_events() =
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

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