Re: Motion events in a DrawingArea
- From: Jeremy Volkening <jdv base2bio com>
- To: gtk-perl-list gnome org
- Subject: Re: Motion events in a DrawingArea
- Date: Thu, 17 Aug 2017 12:27:02 -0500
On Wed, Aug 16, 2017 at 10:12:04PM +1000, Daniel Kasak wrote:
Hi all.
I'm trying to capture mouse events in a DrawingArea ( in Gtk3 ). I'm
adapting code at http://www.perlmonks.org/?node_id=583578 ... but when
Also, when I have used complex DrawingAreas in past projects, it was
convenient to create a separate subclass. Here is the preamble from a
Gtk2 DrawingArea-based widget I wrote:
# --begin code--
package Gtk2::MassCanvas;
use warnings;
use strict;
use 5.012;
use Glib qw/TRUE FALSE/;
use Gtk2;
use Cairo;
use Gtk2::Pango;
use Glib::Object::Subclass
Gtk2::DrawingArea::,
signals => {
expose_event => \&expose,
configure_event => \&resize,
motion_notify_event => \&on_motion,
button_press_event => \&on_click,
button_release_event => \&on_release,
key_press_event => \&_on_key_press,
scroll_event => \&on_scroll,
};
# --end code--
This makes setting up signal handling a piece of cake. I don't know this
still works in Gtk3, however,
Jeremy
--
Truth is the most valuable thing we have -- so let us economize it.
-- Mark Twain
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]