Bonjour à tous,
Je souhaite utiliser les gtkradiobutton et l'un des boutons ne doit pas avoir de label mais un gtkspinbutton. Il y a un example là :
http://library.gnome.org/devel/gtk/2...dioButton.html
qui permet de mettre un gtkentry dans le container du gtkradiobutton.
le seul problème est que l'entry n'est pas accessible, en cliquant dessus, cela ne fait qu'activer le bouton radio.
Voici le code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <gtk/gtk.h>
 
//gcc -std=gnu99 -Wall $(pkg-config --cflags gtk+-2.0) $(pkg-config --libs gtk+-2.0) main.c
 
void create_radio_buttons (void);
 
int main(int argc, char** argv)
{
    gtk_init(&argc, &argv);
    create_radio_buttons();
    gtk_main();
}
 
void create_radio_buttons (void) {
    GtkWidget *window, *radio1, *radio2, *box, *entry;
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    //g_signal_connect(G_OBJECT(window), "destroy"; G_CALLBACK(gtk_main_quit), NULL);
    box = gtk_vbox_new (TRUE, 2);
    /* Create a radio button with a GtkEntry widget */
    radio1 = gtk_radio_button_new (NULL);
    entry = gtk_entry_new ();
    gtk_container_add (GTK_CONTAINER (radio1), entry);              //avec la deuxieme ligne, cela fonctionne
    //gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 2);     //
    /* Create a radio button with a label */
    radio2 = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio1),
                "I'm the second radio button.");
    /* Pack them into a box, then show all the widgets */
    gtk_box_pack_start (GTK_BOX (box), radio1, TRUE, TRUE, 2);
    gtk_box_pack_start (GTK_BOX (box), radio2, TRUE, TRUE, 2);
    gtk_container_add (GTK_CONTAINER (window), box);
    gtk_widget_show_all (window);
    return;
}
configuration : gtk 2.12.9-3, kubuntu 8.04.
Une idée ?
merci.