Re: [gtkmm] Detecting double-click in a treeview and more

Paul Davis <paul linuxaudiosystems com> writes:

> >> true. just be warned that if you have a handler for a single press
> >> and/or single release, these will be executed before the one that sees
> >> the 2 button press. this can get gnarly, quite rapidly.
> >
> >Doesn't connect_notify() take care of this?
> i don't know what that does. my comment is based on GTK+-level
> experiences and some GTK+ documentation (can't find a URL right
> now). the order of events generated for a "double click" is:
>       button-press   (ev->type == GDK_BUTTON_PRESS)
>       button-release
>       button-press   (ev->type == GDK_2BUTTON_PRESS)
>       button-release
> what does connect_notify() do?

I don't think it can fix a situation where you register more than one
callback, but it is easier to use since you don't have to pass false
(or is it true? I forgot) to the extra hidden parameter in connect,
and don't have to return anything from the handler.

I do:

    .connect_notify(SigC::slot(*this, &MainWindow::on_treeview_clicked));


  void MainWindow::on_treeview_clicked(GdkEventButton *event)
    if (event->type == GDK_2BUTTON_PRESS)

Ole Laursen

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