Re: Various Gtk2::DrawingArea questions



Aaron Lewis <alewis1970 yahoo com> writes:

I don't know how to detect the combination of mouse click +
SHIFT/CTRL.

$event->state gives the "GdkModifierType" keys (per Gtk2::Gdk::Event).

3. I also want the user to be able to select multiple rectangles by
   dragging the mouse across a portion of the DrawingArea.

I made a Gtk2::Ex::Lasso (on cpan).  It's "xor" based so depends on a
mostly single colour background but the drawing is fast.

It's basically button-press to start then motion-notify for the drag and
button-release to end.  But you might want to listen for Escape key or
something to abort a selection.

4. The call to Gtk2::Gdk::Drawable->draw_rectangle produces a
   rectangle that's a different size, depending on whether it's filled
   in, or not.

Yes.  That's an artifact of the x11 pixel rule "on the boundary left or
above".  It comes from an unfilled rectangle being a 1-wide line but
filled being a 0-wide boundary ... more or less.

7. It's pretty easy to set up tooltips for a Gtk2::Button or
   Gtk2::Label, but I haven't had any luck with the drawing area
   yet. I found a 'query_tooltip' signal but I can't get it to work,
   nor can I find any perl scripts which do this job.

I think it's supposed to work.  $tooltip->set_text with whatever new
string you want to show.  Post a failing program if not.

You might prefer to show something in a statusbar as the mouse moves.
(In which case motion-notify-event and enter,leave.)

'pointer-motion-hint-mask',

Remember to $window->get_pointer() if using that.  Otherwise you don't
get any more motion events.



-- 
At the Sydney Olympic stadium workmen shortened the 100m track to 94m to
make room for a communications pit.  It was only noticed before the
Games when an under-16 schoolboys meet broke the Commonwealth record.



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