ruby-****@sourc*****
ruby-****@sourc*****
2012年 9月 2日 (日) 03:30:17 JST
------------------------- REMOTE_ADDR = 70.49.49.99 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-txtw-textview ------------------------- @@ -46,6 +46,8 @@ Most new text views are created with the Gtk::TextView.new(buffer=nil). When using this method with the default nil argument an empty Gtk::TextBuffer is created for you. This empty text buffer can be replaced or retrieved by "Gtk::TextView#buffer=(buff)", or "Gtk::TextView#set_buffer(buff)", and "buff = Gtk::TextView#buffer" respectively. With the former two methods the contents of the buffer gets completely replaced. However, as we will see in the following page((*Text Iterators and Marks,*))one can also cause changes to a text buffer only partially. +Recall that we have pointed out that a few widgets provide native scrolling support. Well, Gtk::TextView is one of them. This means you should use Gtk::Container#add method, rather than Gtk::ScrolledWindow#add_with_viewport(child), to add Gtk::TextView to the scrolled windows. + {{image_left("txtv-utf-8.png")}} When handling text buffers, you will be dealing with terms such as((*ofset*))and((*index.*))As with all text widgets in GTK+, text is stored in UTF-8 strings, hence individual characters may be more than one byte long. This may effect the overall meaning or value that offset and index will represent. You can tell what is the size in bytes for an UTF-8 character by looking at the initial bit(s) of the character. Consult the table on the left for details.