Problem Regarding Radio Button
- From: kapil mathur <strikekapil gmail com>
- To: gtk-list gnome org
- Subject: Problem Regarding Radio Button
- Date: Wed, 18 Aug 2010 14:54:16 +0530
Dear Sir/Ma'm ,
I am Kapil Mathur, presently I am associated with a project in which I have to create an installer ,
my problem regarding the same is that I am unable to retrieve which radiobutton is clicked or active
to elaborate on this:
I have created a Notebook and 2 buttons on the window , Inside the notebook page I have group of radio buttons
On the basis of which radiobutton is clicked and of which page I have to perform the action .
I have written a callback function with which I am passing the radiobutton handle as the parameter , but I am unable to access
as to which radio button is active , I am firing the callback function on the button clicked event. Please help me in this regard,
following is the code snippet :
button = gtk_button_new_with_label ("submit ");
g_signal_connect(G_OBJECT (button), "clicked",G_CALLBACK (test_call),( gpointer )radiocomp15); // radiocomp15 is the radio group of 15 buttons
gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 1, 2); // use a table
gtk_widget_show (button);
void test_call( GtkButton *b, GtkRadioButton *rb ) // passing the submit button and the radiobutton to the callback function
{
/* if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( rb )))
g_print( "2 is chosen\n" );
else
g_print( "1 is chosen\n" );*/
GtkRadioAction *action;
action = "" ("myname","mylabel","mytooltip","myid",1);
gtk_radio_action_set_group (action, (GSList*)rb);
GtkWidget *parent = gtk_widget_get_parent(GTK_WIDGET(rb));
parent=gtk_widget_get_parent(GTK_WIDGET(parent));
parent=gtk_widget_get_parent(GTK_WIDGET(parent));
//int num=gtk_notebook_get_current_page(GTK_NOTEBOOK(parent));
int num = gtk_radio_action_get_current_value(action);
printf("The Page number is : %d\n",num);
/*int num=gtk_notebook_get_current_page(note);
printf("The Page number is : %d\n",num);
GtkWidget *child = gtk_notebook_get_nth_page (note,num) ;
//const gchar *str = gtk_notebook_get_tab_label_text(note,child);
const gchar *str = gtk_frame_get_label(GTK_FRAME(child));
printf("Label is : %s\n",str);
/* if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( rb )))
g_print( "2 is chosen\n" );
else
g_print( "1 is chosen\n" );*/
}
How I am going to access the radio button.
Waiting for the reply and thanking you in advance
--
Kapil Mathur
CDAC- R & D-Pune
(GBCE-MTS)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]