PHP-GTK
Saturday, August 02, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGtkHScrollbar
GtkHSeparatornext

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

GtkHScrollbar Constructor

GtkHScrollbar ([GtkAdjustment adjustment = null]);

Creates a new horizontal scrollbar. If the adjustment parameter is omitted or set to null, an GtkAdjustment will be created for you. Since all of the adjustments values are set to 0, it might be easier and faster to construct the adjustment yourself.

Example 72. Creating and styling a vertical scrollbar

<?php
//Creating and styling a vertical scrollbar
 
//At first, define some values for the adjustment
$value     = 50;
$lower     = 1;
$upper     = 100;
$step_incr = 1;
$page_incr = 10;
$page_size = 10;
 
//Create the adjustment with the values
$adj = new GtkAdjustment(
    $value, $lower, $upper,
    $step_incr, $page_incr, $page_size
);
//Create the scrollbar with the adjustment
$sb = new GtkVScrollbar($adj);
//Set the name of the widget, so that it can be styled individually
$sb->set_name('my-scrollbar');
//Re-set the value, since passing the adjustment to the scrollbar
// resets the value to zero
$adj->set_value(50);
 
//Here we apply some style properties to our scrollbar
Gtk::rc_parse_string('
style "mysbstyle" {
  GtkVScrollbar::has-forward-stepper = 0
  GtkVScrollbar::has-secondary-forward-stepper = 1
  GtkVScrollbar::fixed-slider-length = 1
  GtkVScrollbar::min-slider-length = 10
} widget "*.my-scrollbar" style "mysbstyle"');
 
 
//Normal stuff, you know it
$wnd = new GtkWindow();
$wnd->set_default_size(-1, 300);
$wnd->add($sb);
$wnd->show_all();
$wnd->connect_simple('destroy', array('Gtk', 'main_quit'));
 
Gtk::main();
?>

User Contributed Notes
gtk.gtkhscrollbar.constructor.php
add a note about notes
There are no user contributed notes for this page.


previousGtkHScrollbar
GtkHSeparatornext

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:57 2013 CEST