Re: Various Gtk2::DrawingArea questions

2. The 'button-press-event' signal doesn't help me with detecting
double-clicks. Is there a different signal for this?

You can check the event-type in your callback to see if it is a double-click:

# Detect mouse clicks over the drawing area
$drawEventBox->signal_connect ('button-press-event' => sub {
        my $widget = shift;    # GtkWidget      *widget
        my $event  = shift;    # GdkEventExpose *event

        my ($xPos, $yPos, $button) = ($event->x, $event->y, $event->button);

        if($event->type eq '2button-press') {
                print "double-click\n";

        print("Signal button-press-event detected!\n");
        print("x/y: $xPos/$yPos, button: $button\n");

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