Re: GtkExpander label widgets (using buttons as)



Tristan Van Berkom <tristan.van.berkom <at> gmail.com> writes:

David Caldwell wrote:

I have a GtkExpander and I set its label widget to an hbox to
which I added a label and 2 buttons. They all display nicely, but
the buttons don't work properly. When I click on them it activates
the expander instead of the buttons themselves. Actually, a couple
of the button's top and bottom rows of pixles will respond to
mouse clicks, but none of the center area does. Is this supposed
to work?

I would think so...
     actually; when I try out your described setup in the glade3
builder; it definitly worsforme, I wonder if that is only due to the
gui builder environment.

Actually, this code is not directly from glade-2, but created on the
fly via some code orginally adapted from glade (I basically changed
the variable names, and c99-ified it). I'm using stock gtk from Fedora
Core 4 and don't appear to have glade3.

Can you reproduce this misbehaviour in a brief code segment and post
it ?

Here is the snippet that creates the expander:

    GtkWidget *expander = gtk_expander_new(NULL);
    gtk_expander_set_expanded(GTK_EXPANDER(expander), TRUE);
    gtk_box_pack_start(GTK_BOX(plots), expander, FALSE, FALSE, 0);
    
    GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
    gtk_expander_set_label_widget(GTK_EXPANDER(expander), hbox);

    GtkLabel *label = GTK_LABEL(gtk_label_new(plotname));
    gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), TRUE, TRUE, 0);
    gtk_widget_set_sensitive(GTK_WIDGET(label), TRUE);

    GtkWidget *edit_button = gtk_button_new_with_mnemonic("Edit");
    gtk_box_pack_start(GTK_BOX(hbox), edit_button, FALSE, FALSE, 0);
    gtk_widget_set_sensitive(edit_button, TRUE);
    g_signal_connect(edit_button, "clicked",
                     G_CALLBACK(EditPlot), 
                     (gpointer)p);

    GtkWidget *delete_button = gtk_button_new_with_mnemonic("Delete");
    gtk_box_pack_start(GTK_BOX(hbox), delete_button, FALSE, FALSE, 0);
    gtk_widget_set_sensitive(delete_button, TRUE);
    g_signal_connect(delete_button, "clicked",
                     G_CALLBACK(DeletePlot), 
                     (gpointer)p);

    GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
    gtk_container_add(GTK_CONTAINER(expander), vbox);
    // ... put some junk in the vbox

maybe I (or someone else for that matter) can tell you if something
is wrong with your code or maybe we can better pinpoint a bug in
GTK+ that way.

Any help you could provide would be greatly appreciated.

Thanks,
  David




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