Re: [gtk-list] Option widget index
- From: Stefan Ondrejicka <ondrej idata sk>
- To: GTK List <gtk-list redhat com>
- Subject: Re: [gtk-list] Option widget index
- Date: Wed, 16 Jun 1999 09:28:01 +0200 (MET DST)
On Tue, 15 Jun 1999, K. M. Hawarden-Ogata wrote:
Hello ,
> For an option menu widget, how do you read off the selected option, without
> using a callback?
>
> I.e., there is a gtk_option_menu_set_history function which allows the user
> to select which option to display. Is there a complementary function
> gtk_option_menu_get_history which returns that index, say after you click on
> an item?
GTK_OPTION_MENU(omenu)->menu_item is actualy selected menuitem of option
menu. I don't know any option how to get index of menuite, but you can set
to menuitem its index with gtk_object_set_user_data and then get it with
gtk_object_get_user_data.
for example :
create option menu :
index = 0;
mi = gtk_menu_item_new_with_label("0");
gtk_object_set_user_data(GTK_OBJECT(mi) , (gpointer)index);
index++;
[...]
mi = gtk_menu_item_new_with_label("1");
gtk_object_set_user_data(GTK_OBJECT(mi) , (gpointer)index);
index++;
[...]
.....
get index of selected menuitem :
index = GTK_OPTION_MENU(omenu)->menu_item ?
gtk_object_get_user_data(GTK_OBJECT(GTK_OPTION_MENU(omenu)->menu_item)): -1;
Bye,
Stevo.
---
Stefan Ondrejicka <ondrej@idata.sk>
Beethovenova 11, 917 08 Trnava, Slovakia
http://www.idata.sk/~ondrej/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]