Re: Various Gtk2::DrawingArea questions

On Tue, 24 Jul 2012 03:13:02 -0700 (PDT)
Aaron Lewis <alewis1970 yahoo com> wrote:

I'm getting a headache working with Gtk2::DrawingAreas. Seven headaches, to be precise. Perhaps someone can 
offer some Perl paracetemol? 

1. I want to be able to detect mouse clicks. Specifically, I want to know when the user clicks on one of the 
rectangles, so I can write some code to 'select' the rectangle by changing its colour.
2. The 'button-press-event' signal doesn't help me with detecting double-clicks. Is there a different signal 
for this?
3. I also want the user to be able to select multiple rectangles by dragging the mouse across a portion of 
the DrawingArea. 

The DrawingArea is very rudimentary, I would use a Canvas widget, wherein all these
things can be easily done, with Enter and Leave bindings.
 The Goo canvas is very good, but the old Gnome2::Canvas will work as well.

Otherwise, it seems to me that you will need to keep a table of coordinates for
all your DrawingArea items, and do some calculations to see whether you are inside or out.



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