Re: [gtk-list] Re: Questions about child windows



So Alexander Kotelnikov was saying...
> 
> On Sun, 28 Feb 1999, Tom Geiger wrote:
> 
> > I have a couple of questions regarding child windows:
> > 
> > 1) How can you set the child windows position relative to the parent window?
> >    (i.e centered in parent window)
> > 	I've tried: (simple case ignoring parent window's width for now)
> > 
> > 		gdk_window_get_position(parent_window, &x, &y);
> > 		gtk_widget_set_uposition(child_window, &x + 300, &y + 300);
> 
>:) C is a funny language:
>                 gtk_widget_set_uposition(child_window, x + 300, y + 300);

Sorry that was a typo. Here's the actuall code pasted in this time:
   gdk_window_get_position((GdkWindow *)window, &xp, &yp);
   gtk_widget_set_uposition(child_window, xp + 300, yp + 300);

Here's what gdb says:
Breakpoint 1, add_state (callback_data=0x0, callback_action=0, 
    widget=0x80bc0b8) at state.c:307
307             gtk_widget_set_uposition(child_window, xp + 300, yp + 300);
(gdb) print xp
$1 = 16
(gdb) print yp
$2 = 0
(gdb) 

The identify fvwm module says it's at:
x (current page): 59
y (current page): 46

-Tom




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