Re: mouse button event and gtkmm-4.0



Thanks! 

so I just try quickly something like this. Exactly what i need.

auto mouse = Gtk::GestureClick::create();
mouse->set_propagation_phase(Gtk::PropagationPhase::CAPTURE);
mouse->set_button(GDK_BUTTON_PRIMARY);
add_controller(mouse);
mouse->signal_pressed().connect(sigc::mem_fun(*this, &Window::on_mouse_key_pressed), false);

void on_mouse_key_pressed(int, double, double)
{
std::cout << "clic left mouse button" << std::endl;
}

Le lun. 26 sept. 2022 à 19:29, Andrew Potter <agpotter gmail com> a écrit :

On Mon, Sep 26, 2022 at 10:17 AM Duncan Duncan via gtkmm-list <gtkmm-list gnome org> wrote:
Could someone explain how to get  event key mouse ?


Hi,
A question on the list a couple months ago prompted me to make this github gist:


In short, you need a Gtk::GestureClick event controller. The current gtkmm documentation is at https://gnome.pages.gitlab.gnome.org/gtkmm/classGtk_1_1GestureClick.html

Unfortunately google doesn't like returning the gitlab pages links yet.


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