Re: HELP



On Wed, 2007-08-01 at 10:16 -0400, Paul Davis wrote:
> On Mon, 2007-07-30 at 11:07 +0300, Mihai NICULESCU wrote:
> > Hi,
> > 
> > I want to make an application which can draw an image, and let the user 
> > move the image all over the drawing area.
> > 
> > I found in the GTKmm tutorial how to draw an image on a 
> > GTK::DrawingArea, but couldn't figure it out how to move the image when 
> > it is selected. I didn't find any signal for the drawing area when the 
> > cursor moves over it, only *signal_button_press_event()*. And so, I  was 
> > able to capture an event when the mouse clicks on the drawing area, but 
> > not when it moves.
> > 
> > 
> > Basically, all I want to do is to display an image, select it and to 
> > move it with the cursor.
> 
> you can't "move" the image other than by redrawing it. so catch motion
> notify events, and then call queue_draw() on the drawing area widget. in
> the expose handler for the drawing area (where you should be doing all
> your drawing anyway), redraw using the (stored) position of the cursor
> (from the motion notify event).

And this is why there are canvas widgets that abstract this and other
things. goocanvas is your best bet at the moment, though the C++
bindings for it are probably not in a great state.

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com




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