From 2f5dca594f81231fa5d98b1ac2fd2731d82d17f2 Mon Sep 17 00:00:00 2001 From: John Luke Date: Sun, 20 Jul 2003 18:11:11 +0000 Subject: [PATCH] 2003-07-20 John Luke * en/Gtk/FileSelection.xml: update and add example svn path=/trunk/gtk-sharp/; revision=16447 --- doc/ChangeLog | 6 ++- doc/en/Gtk/FileSelection.xml | 84 +++++++++++++++++++++++++++++------- 2 files changed, 73 insertions(+), 17 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 94e44070c..e56eda42f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,8 @@ -2003-07-18 John Luke +2003-07-20 John Luke + + * en/Gtk/FileSelection.xml: update and add example + +2003-07-19 John Luke * en/Gtk/OptionMenu.xml: documented diff --git a/doc/en/Gtk/FileSelection.xml b/doc/en/Gtk/FileSelection.xml index ccd3a29e7..7016c90c3 100644 --- a/doc/en/Gtk/FileSelection.xml +++ b/doc/en/Gtk/FileSelection.xml @@ -9,16 +9,68 @@ Creates a new dialog for the user to select one or more files, directories, or cancel. - FileSelection should be used to retrieve file or directory names from the user. It will create a new dialog window containing a directory list, and a file list corresponding to the current working directory. + should be used to retrieve file or directory names from the user. It will create a new dialog window containing a directory list, and a file list corresponding to the current working directory. The filesystem can be navigated using the directory list or the drop-down history menu. Alternatively, the TAB key can be used to navigate using filename completion - common in text based editors such as emacs and jed. Simple file operations; create directory, delete file, and rename file, are available from buttons at the top of the dialog. - The functionality of the FileSelection can be extended by using the available accessors to the buttons and drop downs. + The functionality of the can be extended by using the available accessors to the buttons and drop downs. + + +using System; +using Gtk; +using GtkSharp; + +class FileSelectionSample +{ + Label lbl; + + static void Main () + { + new FileSelectionSample (); + } + + FileSelectionSample () + { + Application.Init (); + + Window win = new Window ("FileSelectionSample"); + win.SetDefaultSize (250,200); + win.DeleteEvent += new DeleteEventHandler (OnWinDelete); + + VBox vbox = new VBox (true, 1); + win.Add (vbox); + + Button btn = new Button ("Select a file."); + btn.Clicked += new EventHandler (OnButtonClicked); + vbox.Add (btn); + + lbl = new Label ("Selected: "); + vbox.Add (lbl); + + win.ShowAll (); + Application.Run (); + } + + void OnButtonClicked (object o, EventArgs args) + { + FileSelection fs = new FileSelection ("Choose a file"); + fs.Run (); + lbl.Text = "Selected: " + fs.SelectionEntry.Text; + fs.Hide (); + } + + void OnWinDelete (object o, DeleteEventArgs args) + { + Application.Quit (); + } +} + + Gtk.Dialog @@ -52,7 +104,7 @@ Restrict the visible files and directories to those that match the given . A simple wildcard pattern such as '*.txt'. - This method attempts to match to a valid filenames or subdirectories in the current directory. If a match can be made, the matched filename will appear in the text entry field of the file selection dialog. If a partial match can be made, the "Files" list will contain those file names which have been partially matched, and the "Folders" list will show those directories with a partial match. + This method attempts to match to a valid filenames or subdirectories in the current directory. If a match can be made, the matched filename will appear in the text entry field of the . If a partial match can be made, the "Files" list will contain those file names which have been partially matched, and the "Folders" list will show those directories with a partial match. @@ -140,8 +192,8 @@ System.UInt32 - The GLib Type for Gtk.FileSelection - The GLib Type for the Gtk.FileSelection class. + The for + The for the class. @@ -153,7 +205,7 @@ To be added - To be added: an object of type 'Gtk.HButtonBox' + an object of type To be added @@ -165,7 +217,7 @@ To be added - To be added: an object of type 'Gtk.HButtonBox' + an object of type To be added @@ -219,7 +271,7 @@ To be added - To be added: an object of type 'string' + an object of type To be added @@ -230,7 +282,7 @@ Gtk.Entry - The main text entry widget of this file selector. + The main widget of this . @@ -243,7 +295,7 @@ To be added - To be added: an object of type 'Gtk.MessageDialog' + an object of type To be added @@ -257,7 +309,7 @@ The that is displayed by the . A menu containing the file system paths higher than the selected directory, and the user's directory history. - Note that this widget does not just contain history, it contains a list of directories above the current directory in the filesystem as well as user directory history. + Note that this does not just contain history, it contains a list of directories above the current directory in the filesystem as well as user directory history. @@ -294,7 +346,7 @@ Gtk.Button - The 'cancel' of this file selector. + The 'cancel' button of this file selector. @@ -319,7 +371,7 @@ To be added - To be added: an object of type 'Gtk.Label' + an object of type To be added @@ -331,7 +383,7 @@ To be added - To be added: an object of type 'Gtk.Entry' + an object of type To be added @@ -435,11 +487,11 @@ Internal constructor GLib type for the type - Creates a new instance of FileSelection, using the GLib-provided type + Creates a new instance of , using the GLib-provided type This is a constructor used by derivative types of that would have their own GLib type assigned to it. This is not typically used by C# code. - \ No newline at end of file +