Re: gtk_widget_set_uposition() in Gtk-2.0?

Le sam 19/06/2004 à 14:27, David J. Singer a écrit :
> > 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.
> This leads me to think that I'm on the wrong track.   I'm trying to create
> my own "tooltips" (because it seems you can only apply the built-in Gtk-2.0
> tooltips on individual widgets, and I need tooltips for various areas within
> a drawing area).  
> The following code hopefully shows what I'm trying to do, and why 
> I would like to be able to position the window explicity:
>    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);
>    gtk_widget_show_all(window);
>    gdk_window_raise(window->window);
> > Are you compiling with the compiler flag -Wall? If not, I strongly
> > suggest you do.
> I always do.  I understand what the flag does now - I thought it would 
> prevent the code compiling, but I see it just kicks out a compiler warning.

Try using gtk_window_move

Attachment: signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=

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