This example shows how to display a GtkFileSelection.

Once you understand this basic example, you can check out the more advanced Extending GtkFileSelection page, which wraps the standard GtkFileSelection within a class with richer functionality.

Extending GtkFileSelection : the FileSelectionDialog class

This FileSelectionDialog provides a wrapper around the standard GtkFileSelection class in PHP-GTK2, to make it easier to use.

Note : you can check a simpler introductory example to GtkFileSelection before delving into this class.

Main methods :

  • hide()
  • show()
  • get_selection() : return file section if OK pressed, return false if cancel button is pressed. (see usage below)

Quick overview (usage)

You can see how it easy to get a file ; all you need to do is to create a FileSelectionDialog instance and call the get_selection() method.

Syndicate content