Re: Motion events in a DrawingArea
- From: Daniel Kasak <d j kasak dk gmail com>
- To: max augsburg gmx de
- Cc: gtk-perl mailing list <gtk-perl-list gnome org>
- Subject: Re: Motion events in a DrawingArea
- Date: Thu, 17 Aug 2017 20:24:59 +1000
Thanks for the response Max. I'm already quite invested in the Cairo
path - this is an existing project that I'm enhancing. I'm getting
close to another release of it. Preview:
http://tesla.duckdns.org/images/powercom.jpg
It's a visualisation app for energy stats that lets you plug in data
sets to add new graph series. In my case ( ie screenshot ), I'm
graphing energy production ( solar panels ) in blue, energy sold to
the grid in green, general energy use in red, and controlled load (
hot water circuit ) in black. I'll check out GooCanvas for future
projects, but now I'm just trying to hack in some crosshairs that
follow the mouse and give an exact display of the co-ordinates ...
preferably without a major rewrite.
On Thu, Aug 17, 2017 at 2:36 AM, <max augsburg gmx de> wrote:
Dear Dan,
I think the simplest solution would be to use my GooCanvas2 module (see
https://metacpan.org/pod/GooCanvas2 ). The module works exactly as the C Api
(it's a pure Glib::IO binding). Therefore
https://developer.gnome.org/goocanvas/unstable/ is a good starting point...
Especially the GooCanvas2::CanvasItem has an item press event and such
things:
https://developer.gnome.org/goocanvas2/stable/GooCanvasItem.html#GooCanvasItem-button-press-event
Perhaps this is helpful...
The Gtk3 canvas element (from which I think DrawingArea inherits its
painting capabilities) is hard to handle for event purposes...
Best wishes,
Max
Gesendet: Mittwoch, 16. August 2017 um 14:12 Uhr
Von: "Daniel Kasak" <d j kasak dk gmail com>
An: "gtk-perl mailing list" <gtk-perl-list gnome org>
Betreff: Motion events in a DrawingArea
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
I go:
$self->{drawing_area}->set_events(
[ qw/ exposure-mask
leave-notify-mask
button-press-mask
pointer-motion-mask
pointer-motion-hint-mask
/
]
);
... I get a warning:
Gtk-CRITICAL **: gtk_widget_set_events: assertion
'!_gtk_widget_get_realized (widget)' failed
I've tried putting this later on in the code when I guess the widget
*should* be realized, eg at the end of the render_graph() method which
I hook up thus:
$self->{drawing_area}->signal_connect( draw => sub {
$self->render_graph( @_ ) } );
... but it still gives the same error.
Next I try to connect to a signal handler anyway:
$self->{drawing_area}->signal_connect(
'motion_notify_event'
, sub { $self->handle_graph_mouse_move( @_ ) }
);
... but this handler never gets called.
I guess things have changed in Gtk3? I haven't been able to find an
updated demo, even in C. Any hints as to what I'm missing?
Dan
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]