Webhosting and cheap domain registration service
  

 Home

GtkOptionMenu
Prev GtkOptionMenu Constructor Next

GtkOptionMenu Constructor

Constructing a GtkOptionMenu is less complicated that creating most other forms of menu.

Example 29. Creating a simple GtkOptionMenu.

<?php

dl('php_gtk.' . (strstr(PHP_OS, 'WIN') ? 'dll' : 'so'));

function echo_activated($item, $label, $rank, $x) {
    echo "\$items[$x] ('$label') is the $rank 
".$item->get_name().".\n";
    flush();
}

$window = &new GtkWindow();
$window->set_position(GTK_WIN_POS_CENTER);
$window->connect_object('destroy', array('gtk', 'main_quit'));

$menu = &new GtkMenu();
$labels = array('File', 'Edit', 'Save', 'Exit');
$pos = array('first', 'second', 'third', 'fourth');
for($i = 0; $i < 4; $i++) {
$items[$i] = &new GtkMenuItem($labels[$i]);
$items[$i]->connect('activate', 'echo_activated', $labels[$i], $pos[$i], 
$i);
$menu->append($items[$i]);
}
$menu->show_all();

$optionmenu = &new GtkOptionMenu();
$optionmenu->set_menu($menu);
$window->add($optionmenu);

$window->show_all();
gtk::main();

?>


Prev Home Next
GtkOptionMenu Up GtkOptionMenu::get_menu

 

  

Network sites:

Cheap domain registrar's cheap domain registration service

$8.95 domain registration : Buy domain name or register domain name 

 
 
Quotes:
There is only one thing in the world worse than being talked about, and that is not being talked about.  
 
 

Disclaimer: This documentation is provided only for the benefits of our webhosting customers.
For authoritative source of the documentation, please refer to http://gtk.php.net/docs.php