Re: catching mouse click events in a Gtk::TextView
- From: "Francis (Grizzly) Smit" <grizzly smit id au>
- To: gtkmm-list gnome org
- Subject: Re: catching mouse click events in a Gtk::TextView
- Date: Sat, 11 May 2013 02:57:53 +1000
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/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]