Re: gtk_widget_set_uposition() in Gtk-2.0?



Hi,

"David J. Singer" <doc deadvirgins org uk> writes:

> > This function is only really useful on a window, so you are supposed
> > to use gtk_window_set_position() instead.
> 
> But gtk_window_set_position() doesn't allow an arbitrary position to
> be specified.  You can only really position at the center or the
> mouse position.

Well, you want to use gtk_window_move() then.

>    window = gtk_window_new(GTK_WINDOW_POPUP);
>    hbox = gtk_hbox_new(FALSE, 0);
>    gtk_container_add(GTK_CONTAINER(window), hbox);
>    label = gtk_label_new("text goes here");
>    gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 4);
>    gtk_widget_realize(window);
>    gdk_color_parse("yellow", &colour);
>    gtk_widget_modify_bg(window, GTK_STATE_NORMAL, &colour);
>    gtk_window_set_position(GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
>   /*    gtk_widget_set_uposition(GTK_WINDOW(window), x, y); */
>    gdk_window_set_decorations(window->window, 0);

You don't need to unset decorations on a popup window.

>    gtk_widget_show_all(window);
>    gdk_window_raise(window->window);

Use gtk_window_present() instead of gdk_window_raise(). That will
allow you to write your code w/o accessing window->window so you can
get rid of the nasty call to gtk_widget_realize().


Sven



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