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



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);


> * 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.


> - 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.


Damon




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