PHP-GTK
Monday, November 24, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGtkFileSelection
GtkFileSelection::completenext

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

GtkFileSelection Constructor

GtkFileSelection ([string title = null]);

Use the constructor to create a prompt for the user to select a file or directory. By default, a GtkTreeView of the application's current working directory and its file listing will be displayed. Operation buttons and the drop-down history of directories are also visible.

Example 67. An example for a GtkFileSelection prompt.

<?php
//Creating and initialising the file selection prompt
$filePrompt = new GtkFileSelection('GtkFileSelection Demo');
$filePrompt->connect_simple(
    'destroy',
    array('Gtk', 'main_quit')
);
 
//Adding a quit button that destroys the prompt
$filePrompt->cancel_button->set_label('Quit');
$filePrompt->cancel_button->connect_simple(
    'clicked',
    array($filePrompt, 'destroy')
);
 
//Add an OK button that displays the file selected on click
$filePrompt->ok_button->set_label('Show the file');
$filePrompt->ok_button->connect('clicked', 'showFile');
 
//Callback function that displays the file name
function showFile($okbutton)
{
    $filePrompt = $okbutton->get_toplevel();
    $fileName = $filePrompt->get_filename();
    $message = new GtkMessageDialog(
        null,
        0,
        Gtk::MESSAGE_INFO,
        Gtk::BUTTONS_OK,
        'You selected: ' . $fileName
    );
    $message->run();
    $message->destroy();
}
 
//Show the prompt and start the main loop
$filePrompt->show();
Gtk::main();
?>

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


previousGtkFileSelection
GtkFileSelection::completenext

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