ruby-****@sourc*****
ruby-****@sourc*****
2012年 9月 15日 (土) 03:02:57 JST
------------------------- REMOTE_ADDR = 184.145.80.187 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-txtw-textview ------------------------- @@ -9,18 +9,18 @@ As just hinted, this widget is not only used to display simple text, it can also be used to display many types of rich text, and interactive documents used by a variety of different applications. This is what we will learn here and in the following pages. -Let us start with a simple example of Gtk::TextView widget inside a Gtk::ScrolledWindow widget. This listing illustrates the simplest text view example that you could create: +Let us start with the simple minimal example of Gtk::TextView widget, that we borrowed in the introduction to scrolling on the previous page. The first thing to remember is that text view has a built in scrolling support that it has to be added to the Gtk::ScrolledWindow widget. The "textview.rb" listing illustrates the simplest text view example that you could create: + ((*textview.rb*)) #!/usr/bin/env ruby require 'gtk2' - window = Gtk::Window.new(Gtk::Window::TOPLEVEL) + window = Gtk::Window.new("Text View") window.resizable = true - window.title = "Text Views" window.border_width = 10 - window.signal_connect('delete_event') { Gtk.main_quit } + window.signal_connect('destroy') { Gtk.main_quit } window.set_size_request(250, 150) textview = Gtk::TextView.new @@ -34,6 +34,8 @@ window.add(scrolled_win) window.show_all Gtk.main + + === Text Buffers