Re: Option Menus



On Tue, 13 Aug 2002 22:44:09 +0100 "Colin Thomas" <colin in2fab com>
wrote:

Hi,

I have a dumb question.

I have defined a Option menu, and need to access what is currently 
choosen. I know there is a gtk_entry_get_text to get text data. Is there

a similar for option menus ?? My GTK books only seem to cover how to 
create the option menu, not get data back from them ;-(

you need something similar to this (this is for a regular menu where you
need the state of the menu-entry):

g_signal_connect(G_OBJECT(menuitem),
"activate",G_CALLBACK(blabla_callback), some_data_pointer);

static void blabla_callback(GtkMenuItem *menuitem,gpointer
some_data_pointer) {
        if (GTK_CHECK_MENU_ITEM(menuitem)->active) {
                /* do something */
        } else {
                /* do something else */
        }
}

I hope this helps,
        Olivier

Attachment: pgpt8CSlqjD0k.pgp
Description: PGP signature



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