Re: dialog




Pauli Virtanen <virtanen@jytko.jyu.fi> writes:

> Two days ago
> 
> I asked:
> 
> >I have some ten dialogs, too.
> >They work separately just perfect,
> >when the dialog is created by gtk_dialog_new();
> 
> >What I want, is to have a dialog on my scrolled window
> >without window manager decoration. Just like this:
> 
> 	-------------------------------------------------
>         |         scrolled window                       |
>         |                                               |
>         |       ---------------------------------       |
>         |       |       dialog                  |       |
>         |       |                               |       |
>         |       ---------------------------------       |
>         |                                               |
>         -------------------------------------------------
> 
> >I want to pop them up by pulldown menu calls.
> Now I have what I wwant, but still one problem remains:
> ** WARNING **: file gtkcontainer.c: line 346 (gtk_container_add): "widget->parent == NULL"
> The essentials are:
> void luo_dialogi(
> GtkWidget *isa)		// isa = top_level_window
> {
>     GtkWidget *vbox;
>     GtkWidget *table, *hbox;
> 
>     dialog = gtk_dialog_new();
>     dialog->parent = isa;
>     gtk_container_border_width(GTK_CONTAINER(dialog), 5);
> [snip]
>     gtk_widget_realize(dialog);
>     gtk_widget_reparent(dialog, scroll);	// scroll  public
> }
> To get just what I want, I must reparent to scrolled window.
> Everything works just fine, but I don't like that warning message.
> Could someone with more experience help me.

If this works at all, you are very lucky. ;-)

A scrolled window is not a toplevel widget at all, and a
Dialog is a toplevel widget and cannot meaningfully
be reparented as a child widget .

What you want to do is create a Window widget with 

  gtk_window_new (GTK_WINDOW_POPUP);

This creates an "override-redirect" window - one that
won't be seen by your window manager.

Put your scrolled window inside of that, and then put 
the contents inside the scrolled window. You'll have
to duplicate the dialog widget by hand, but that isn't
much of a hardship - the dialog widget just contains
a VBox with a HSeparator and a HBox (the action_area).

Hope this helps,
                                        Owen



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