PHP-GTK
Tuesday, July 29, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGtkLabel::set_single_line_mode
GtkLabel::set_text_with_mnemonicnext

Last updated: Sun, 12 May 2013
view this page in English

GtkLabel::set_text

Sets the text within the label. It overwrites any text that was there before. Pango markup will not be used; you have to use set_markup() for this.

This will also clear any previously set mnemonic accelerators.

Example 92. Setting the Text of a GtkLabel

<?php
function updateCounter($label)
{
	// Set the label text to the current text plus one.
	$label->set_text($label->get_text() + 1);
}
 
// Create a window to hold the label.
$window = new GtkWindow();
 
// Set up the window to close cleanly.
$window->connect_simple('destroy', array('Gtk', 'main_quit'));
 
// Create a label.
$label = new GtkLabel('0');
 
// Create a button that will be used to increment the counter.
$button = new GtkButton('Click Me!');
 
// When the button is clicked, the counter should be updated.
$button->connect_simple('clicked', 'updateCounter', $label);
 
// Create a vbox to hold the label and button.
$vBox = new GtkVBox();
 
// Add the label & button to the box.
$vBox->pack_start($label);
$vBox->pack_start($button);
 
// Add the box to the window.
$window->add($vBox);
 
// Show the window and start the main loop.
$window->show_all();
Gtk::main();
?>

See also: get_text() , set_text_with_mnemonic() , set_label() , set_markup()


User Contributed Notes
gtk.gtklabel.method.set_text.php
add a note about notes
There are no user contributed notes for this page.


previousGtkLabel::set_single_line_mode
GtkLabel::set_text_with_mnemonicnext

Last updated: Sun, 12 May 2013
view this page in English


credits 

PHP  Copyright © 2001-2014 The PHP Group
 All rights reserved.
Last updated: Sun May 12 20:50:59 2013 CEST