You can do it by doing the following, mind you none of this code has been "tested", so you will need to tweak a few things, but these are the basics of what you need to do, to ensure that you capture mouse down, and mouse up events, as well as motion events for when the user moves the mouse over the drawing area.

def drawingarea1__button_press_event(*args)
  @capture = true
  if args[1].button == 1  # Left Button down
    @button = :left
  elsif args[1].button == 2 # Middle Button down
    @button = :middle
  elsif args[1].button == 3 # Right Button down
    @button = :right
  end
  @start_x = args[1].x
  @start_y = args[1].y
end

def drawingarea1__button_release_event(*args)
  @capture = false
  @button = nil
  @end_x = args[1].x
  @end_y = args[1].y
end

def drawingarea1__motion_notify_event(*args)
  x, y = @builder["drawingarea1"].pointer

  if @capture
    # Do drawing logic here
  end
end


hth,

Mario


On Sat, Dec 15, 2012 at 4:38 PM, Patrik K. <ruby-forum-incoming@andreas-s.net> wrote:
Hi there

I put a drawing area into my GUI class:
window1 / vbox1 / drawingarea1

Can someone tell me how to draw lines circles and boxes on it by mouse?

BR
Pat

--
Posted via http://www.ruby-forum.com/.

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
ruby-gnome2-devel-en mailing list
ruby-gnome2-devel-en@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en



--
Mario Steele
Fleet Captain
CO - Geo 99
CO - USS T'hy'la
XO - Diplomatic Corps - Second Life
http://www.iftcommand.com/chapters/thyla/
http://www.trekfederation.com