Re: option menus

Peter Jay Salzman wrote:

can someone email me a hello world example of an option menu with like 2
or 3 options?  say, "red" "green" and "blue" or something dumb like

even a small program that makes use of an option menu for me to dissect
would be helpful.

  # Construct a GtkOptionMenu 'optionmenu'
  $optionmenu = new Gtk::OptionMenu();              
  $frame->add($optionmenu );

  $menu = new Gtk::Menu;

  $item0 = new Gtk::MenuItem('Red' );

  $item1 = new Gtk::MenuItem('Green' );

  $item2 = new Gtk::MenuItem('Blue' );

  $menu->append($item0 );
  $menu->append($item1 );
  $menu->append($item2 );

  $optionmenu->set_menu($menu );
  $optionmenu->set_history( 0 );

I don't know if this is the best way but it works - excuse any edit 

HTH, Dermot

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