Web hosting and cheap domain register services
  

 Home

GtkEntry
Prev GtkEntry Constructor Next

GtkEntry Constructor

GtkEntry (void);

Creates a widget that will hold a single line of text, either set programmatically through set_text() or entered by the user.

Example 15. Retrieving text from a GtkEntry widget

<?php

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

/* set up a function to collect the input from the entry and print it */
function get_input($entry) {
  $input=$entry->get_text();
  echo "$input\n";
  $entry->grab_focus();
  $entry->set_text("");
}

/* set up the window */
$window = &new GtkWindow();
$window->set_position(GTK_WIN_POS_MOUSE);
$window->connect_object('destroy', array('gtk', 'main_quit'));

/* add a box container to the window to allow more than one child widget */
$box = &new GtkVBox();
$window->add($box);

/* add a GtkEntry to the box and connect it to the callback function */
$entry = &new GtkEntry();
$entry->connect('activate', 'get_input');
$box->add($entry);

/* add a GtkButton to the box and use connect_object() so that it
   will pass the GtkEntry to the callback when it is clicked */
$button = &new GtkButton('Return or click me to echo input');
$button->connect_object('clicked', 'get_input', $entry);
$box->add($button);

/* display everything and set the main loop running */
$box->show_all();
$window->show_all();
gtk::main();

?>


Prev Home Next
GtkEntry Up GtkEntry::set_text

 

  

Network sites:

Active-Domain.com: cheap domain register and domain name registration

Cheap domains registration and domain transfer with free domain hosting 

 
 
Quotes:
Nothing is so hard for those who abound in riches as to conceive how others can be in want.  
 
 

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