Re: [gtk-list] Re: bug in notebook, or not good behavior ?



Damon Chaplin wrote:

> Antonio Campos wrote:
> >
> > Nobody answered to this e-mail, so I will re-post it in the hope of some
> > interest:
> >
> > I asked someday for a way to be notified of enter or leave events in a
> > notebook sheet.
> > Havoc answered that I should insert a eventbox with a label as the label
> > for the notebook, for being notified of those events.
> > I made a simple test program to check this, that is attached to the
> > mail.
> > To compile: gcc prog.c -o prog `gtk-config --cflags --libs`, as you all
> > know.
> >
> > As you can see, I insert a two normal labels, and then a hbox with a
> > label, and a eventbox with a label as notebook labels.
> > A lot of strange behaviors show:
> >
> > * The hbox isn't correctly resized to show the label. Even more, if you
> > uncomment the line:
>
> You forgot to show the label. You need to do something like:
>
>   hbox=gtk_hbox_new(TRUE,0);
>   label = gtk_label_new("hbox with label");
>   gtk_widget_show (label);
>   gtk_box_pack_start_defaults(GTK_BOX(hbox), label);
>

I do a gtk_widget_show_all(w); where w is the toplevel window that holds the
notebook.
I thought that this call would show all children of the toplevel window,
including the notebook, the event_box and the hbox in the notebook, and the
labels inside the event_box and the hbox (as a recursive show).
But now I understand, that this call only shows the direct children of the
widget we pass to the function. So only the notebook is shown. Then when the
notebook is shown, it shows the labels. But I understand now that the
event_box and the hbox are shown, but not their children, unless I do what you
say.
Sorry, stupid of me.

>
> > * The eventbox isn't correctly resized to show the label either. In the
> > same way, if you uncomment the line:
>
> This is the same mistake.
>
> > - The eventbox color is not the expected one inside the notebook label
> > as you can see. (Maybe this is not an incorrect behavior, because the
> > eventbox has an associated window, from where the background color is
> > taken, and that color is the "abnormal"? color showing).
>
> It looks like GtkNotebook can't really handle child tab widgets which have
> their own windows.
>

Yes, it looks like that.

>
> > - The most serious problem is that although the eventbox widget gets the
> > enter or leave notifications (that was the main reason why I made this
> > test program), when you click on the eventbox inside the notebook, you
> > will see that the notebook doesn't change the page. However, if you
> > press the Tab key to change the focus over the eventbox widget, and then
> > press Space to select it, then the notebook DOES change the page. (Very
> > strange, isn't it?).
>
> This is a similar problem with windows. GtkNotebook just ignores the button
> press event, since it only takes notice of events in its own windows:
>
>   if (event->window == notebook->panel)
>
> I think your only hope for getting notified when the mouse moves over a tab
> label is to subclass GtkNotebook and add your own "tab_enter"/"tab_leave"
> signals to that.
>

Any good documentation for making widget subclasses?. Better than the
Tutorial, please...

>
> Damon
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null

Many, many thanks for your patience. There is always a kind soul.





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