[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - tut-gtk2-filechooser

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2009年 1月 21日 (水) 23:33:00 JST


-------------------------
REMOTE_ADDR = 74.15.84.244
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-filechooser
-------------------------
@@ -34,7 +34,7 @@
   * Gtk::FileChooser#set_filter(filter) - Same as Gtk::FileChooser#filter=.
   * Gtk::FileChooser#add_filter(filter) - Adds filter to the list of filters that the user can select between.
 
-To give you an idea how some of these fit together let's look at the example you can copy-and-paste into a file on your system and run. The top window contains three widgets: (1) folder button, (2) file button, and (3) originally an empty (nil) label. Pay  attention that the example also uses a Gtk::FileChooserDialog object which is spawned when user clicks on the top "folder" button. Of course in your programs you can create a dialogue object on its own via Gtk::FileChooserDialog.new, however in our example program these dialogues are created for you when either button in the top window is pressed. In this case I want you to pay attention to the object "w" in the signal handling callback, activated when ((*'selection_changed'*)) signal is emitted normally after the "chooser_dir"  button is pressed and a new or different folder is selected, this is the place where we add the extra widget to the Gtk::FileChooserDialog widget. This object ("w") is actually a file chooser button widget, however as you can see, through it we add the extra button to the Gtk::FileChooserDialog widget. This magic happens via Gtk::FileChooser#extra_widget=, since both file chooser button an dialogue implement Gtk::FileChooser interface and can therefore be used interchangeably. Note also, that in the window with the two file chooser buttons the 3rd object (the label) reflects users's file selection from the FileChooserDialog spawned when user clicked the "FileChooserDialog" object and actually selected some file. That file is obtained and the label initiated in the "file_changed" callback. Lastly, note that GLib class method is used to initialize both buttons' current folder "chooser_*.current_folder = GLib.home_dir".
+To give you an idea how some of these fit together let's look at the example you can copy-and-paste into a file on your system and run. The top window contains three widgets: (1) folder button, (2) file button, and (3) originally an empty (nil) label. Pay  attention that the example also uses a Gtk::FileChooserDialog object which is spawned when user clicks on the top "folder" button. Of course in your programs you can create a dialogue object on its own via Gtk::FileChooserDialog.new, however in our example program these dialogues are created for you when either button in the top window is pressed. In this case I want you to pay attention to the object "w" in the signal handling callback, activated when ((*'selection_changed'*)) signal is emitted normally after the "chooser_dir"  button is pressed and a new or different folder is selected, this is the place where we add the extra widget to the Gtk::FileChooserDialog widget. This object ("w") is actually a file chooser button widget, however as you can see, through it we add the extra button to the Gtk::FileChooserDialog widget. This magic happens via Gtk::FileChooser#extra_widget=, since both file chooser button an dialogue implement Gtk::FileChooser interface and can therefore be used interchangeably. Note also, that in the window with the two file chooser buttons the 3rd object (the label) reflects users's file selection from the FileChooserDialog spawned when user clicked the "FileChooserDialog" object and actually selected some file. That file is obtained and the label initialized in the "file_changed" callback. Lastly, note that GLib class method is used to initialize both buttons' current folder "chooser_*.current_folder = GLib.home_dir".
 
 
 {{image_left("ChooseYourFile.png")}}



ruby-gnome2-cvs メーリングリストの案内
Back to archive index