Combobox in radio button stay "pressed"....



Hi,

I've noted a little problem when using a combobox into a radio button with gtk+-1.2.10 : Indeed, when selecting the radio button (with the combo) by clicking on the label with the mouse, the button of the combo looks as pressed (move the mouse on an other location).

It's a known problem?
(Not tested with gtk2)

An example is attached to make some tests...
Compilation :
gcc radio_combobox.c -o radio_combobox `gtk-config --cflags --libs`

Jerome

--
EasyTAG - Tag editor for MP3 and OGG files
http://easytag.sourceforge.net
--
Jerome COUDERC <j couderc ifrance com>
/*
 * gcc radio_combobox.c -o radio_combobox `gtk-config --cflags --libs`
 */

#include <gtk/gtk.h>

int main (int argc, char *argv[])
{
    GtkWidget *Window, *Frame, *VBox, *hbox, *vbox;
    GtkWidget *radio_11, *radio_12, *radio_21, *radio_22;
    GtkWidget *label, *combo;

    gtk_init( &argc, &argv );

    Window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_signal_connect (GTK_OBJECT(Window), "delete_event", GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
    gtk_container_set_border_width (GTK_CONTAINER(Window), 5);

    VBox = gtk_vbox_new(FALSE,2);
    gtk_container_add(GTK_CONTAINER(Window),VBox);


    /* Frame 1 */
    Frame = gtk_frame_new("Frame 1");
    gtk_box_pack_start(GTK_BOX(VBox),Frame,TRUE,TRUE,0);
    vbox = gtk_vbox_new(FALSE,0);
    gtk_container_add(GTK_CONTAINER(Frame),vbox);
    gtk_container_border_width(GTK_CONTAINER(vbox),4);

    /* Item 1 */
    radio_11 = gtk_radio_button_new_with_label(NULL,"Radio 1.1");
    gtk_box_pack_start(GTK_BOX(vbox),radio_11,FALSE,FALSE,0);
    /* Item 2 */
    radio_12 = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(radio_11),"Radio 1.2");
    gtk_box_pack_start(GTK_BOX(vbox),radio_12,FALSE,FALSE,0);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_11),TRUE);


    /* Frame 2 */
    Frame = gtk_frame_new("Frame 2");
    gtk_box_pack_start(GTK_BOX(VBox),Frame,TRUE,TRUE,0);
    vbox = gtk_vbox_new(FALSE,0);
    gtk_container_add(GTK_CONTAINER(Frame),vbox);
    gtk_container_border_width(GTK_CONTAINER(vbox),4);

    /* Item 1 */
    radio_21 = gtk_radio_button_new_with_label(NULL,"Radio 2.1");
    gtk_box_pack_start(GTK_BOX(vbox),radio_21,FALSE,FALSE,0);
    /* Item 2 */
    radio_22 = gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(radio_21));
    gtk_box_pack_start(GTK_BOX(vbox),radio_22,FALSE,FALSE,0);
    // Set a label and a combobox in the item 2
    hbox = gtk_hbox_new(FALSE,0);
    gtk_container_add(GTK_CONTAINER(radio_22),hbox);
    label = gtk_label_new("Radio 2.2 : ");
    gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
    combo = gtk_combo_new();
    gtk_box_pack_start(GTK_BOX(hbox),combo,TRUE,TRUE,0);
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_21),TRUE);


    gtk_widget_show_all (Window);
    gtk_main ();         
    return 0;
}


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