Re: Option Menu
- From: Ignacio Nodal <inodal teleline es>
- To: John Cupitt <john cupitt ng-london org uk>, GTK-List <gtk-list gnome org>
- Subject: Re: Option Menu
- Date: Wed, 04 Jul 2001 15:04:50 +0200
John Cupitt wrote:
> Hi Ignacio, I'm not sure you should be using radio items with an option
> menu. Here's what I do:
>
> --
> optionview->options = gtk_option_menu_new();
> gtk_box_pack_start( GTK_BOX( hb ),
> optionview->options, FALSE, FALSE, 2 );
> pane = gtk_menu_new();
> for( p = option->labels, i = 0; p; p = p->next, i++ ) {
> item = gtk_menu_item_new_with_label( (char *) p->data );
> gtk_signal_connect( GTK_OBJECT( item ), "activate",
> GTK_SIGNAL_FUNC( optionview_change_cb ),
> optionview );
> gtk_menu_append( GTK_MENU( pane ), item );
> }
> nitems = i;
> gtk_widget_show_all( GTK_WIDGET( pane ) );
> gtk_option_menu_set_menu(
> GTK_OPTION_MENU( optionview->options ), pane );
> i = CLIP( 0, option->value, nitems - 1 );
> gtk_option_menu_set_history( GTK_OPTION_MENU( widget ), i );
> --
I do more or less the same except that I used radiobuttons...
It works fine, the only problem is the one mentioned in my previous
email:
If a selection has not yet been made (using the mouse), the first menu
item is always the selected one, no matter what I've passed using
gtk_option_menu_set_history() before.
Any idea 'bout this?
Just another thing. Whatfor do you use this code-line? I don't
understand it.
i = CLIP( 0, option->value, nitems - 1 );
Thanks again,
Ignacio Nodal
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]