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
that?

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' );
  $item0->show;
  $item0->activate;               

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

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

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

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

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

HTH, Dermot




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