Get label from selected Menu item/Option Menu in GTK+ 1.2 ??



Hi,

Is there a way to get the currently selected menu item
in an option menu WITHOUT using a signal?

I have an array of pointers to several kinds of
widgets. I want to test what kind of widget they are,
and next get the relevant value of it. Like


 GtkWidget  *Items[NUMBER_OF_ITEMS +1];
 
  Items[NUMBER_OF_ITEMS]=NULL;
  items[0] = gtk_entry_new (); etc
  Items[1] = gtk_option_menu_new (); etc
  
  Then, call a function 
  
  store_values(Items);
  
  which is like (with, for the example,  g_prints
instead of whatever i am going to do with it.)
  
  
   int store_values(GtkWidget *entry[]){
    while(*entry){
      if (GTK_IS_EDITABLE(*entry))
	g_print(
gtk_editable_get_chars(GTK_EDITABLE(*entry++),0,-1) );
      else
	if (GTK_IS_OPTION_MENU(*entry)){
	  GETTHELABELOFTHIS(gtk_menu_get_active
(GTK_MENU(gtk_option_menu_get_menu(GTK_OPTION_MENU(*entry++)))));
	}
	else entry++;
    }
  return (1);
  };
  
  But I cannot find any function "GETTHELABELOFTHIS"
which gives me the string in the label of the active
menu item. I tried to go down in the hierarchy, like
item->bin->child->name to get the label, but this
didnt work either.
  
  I do understand that I can connect a signal to the
option menu which stores the string in an array, every
time a different menu item is selected, and use this
variable to get the string out by passing it as a
second parameter to the function above. That is not
what I want. I need one run through all my widgets to
get all the set values by the user at a  certain time.
  
  

 gtk-config --version
1.2.10


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



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