Re: Gtk::Image location



I tried get_pointer(), but it seems not correct.

The layout of my window is like this: 

hpan.pack(list);
hpan.pack2(scrollwindow);
scrollwindow.add(eventbox);
eventbox.add(image);

If I use eventbox.get_pointer(x, y). The x and y are still coordinate
within scrollwindow, that shows the origin of eventbox is the same as
origin of scrollwindow.

But currently, my image is located in the center of scrollwindow which
has a offset from scrollwindow's origin.

I also tried get_origin(x, y), but it does not make sense either.

xj



On Sat, 2009-07-18 at 21:14 +0100, Chris Vine wrote:
> On Sat, 18 Jul 2009 11:43:28 -0400
> xp <xjpeng buffalo gmail com> wrote:
> 
> > Thanks for reply.
> > 
> > Yes, what I want is to catch the signal of mouse motion. Actually, I
> > also used Gtk::EventBox. The problem is although I can catch the mouse
> > motion event, the event->x and event->y is for ScrollWindow, but what
> > I want is those coordinates to image.
> > 
> > So I want to know the origin coordinate of image respect to
> > scrollwindow. Or is there any other way to get the coordinates of
> > image?
> 
> If you call Gtk::Widget::get_pointer() in the motion notify callback
> for the event box, that will provide the pointer position in widget
> (event box/image) co-ordinates rather than GDK/X co-ordinates, which
> looks as if it is what you want.
> 
> Chris
> 



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