Re: getting the origin of a window
"Jacques Le Normand" <[email protected]>
| Newsgroups | gmane.comp.lang.ocaml.lib.gtk |
|---|---|
| Message-ID | <[email protected]> |
small typo: let get_coordinates_at_offset buffer view i = let iter = buffer#get_iter (`OFFSET i) in let rectangle = view#get_iter_location iter in let x_origin,y_origin = Gdk.Window.get_position view#misc#window in (rectangle.x+x_origin,rectangle.y+y_origin) On Wed, Mar 26, 2008 at 1:46 AM, Jacques Le Normand <[email protected]> wrote: > I need to get to get the coordinates of a position in a textview. Consider > this function: > > let get_coordinates_at_offset buffer view i = > let iter = buffer#get_iter (`OFFSET i) in > let rectangle = view#get_iter_location iter in > let x_origin,y_origin = Gdk.Window.get_position w#misc#window in > (rectangle.x+x_origin,rectangle.y+y_origin) > > which takes a textbuffer and a textview and an offset and returns the > (x,y) coordinate of the offset. Is this correct? Or do I need > gtk_window_get_position(window,&x,&y) ? > > > > > > On Wed, Mar 26, 2008 at 1:15 AM, Jacques Garrigue < > [email protected]> wrote: > > > From: "Jacques Le Normand" <[email protected]> > > > > > is there a way to get the position of a window in lablgtk? > > > in gtk you would use > > > > > > gtk_window_get_position(window,&x,&y) > > > > > > in haskell you would do > > > > > > do > > > dw <- widgetGetDrawWindow window > > > drawWindowGetOrigin dw > > > > Lablgtk is close to Haskell: > > > > Gdk.Window.get_position w#misc#window > > > > Note however that this is not the same thing as > > gtk_window_get_position, which takes decorations and gravity into > > account. (Look at the gtk documentation.) > > This last function is not interfaced currently. > > If you really need it, please tell us. > > > > Jacques > > > > _______________________________________________ Lablgtk mailing list [email protected] http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk