ruby-****@sourc*****
ruby-****@sourc*****
2012年 9月 5日 (水) 04:03:00 JST
------------------------- REMOTE_ADDR = 70.49.49.99 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-txtw-itrsmrks ------------------------- @@ -137,7 +137,14 @@ iter = textview.buffer.get_iter_at_mark(mark) -The other method for retrieving text iterators in our function called "retrieve_text" is Gtk::TextBuffer#bounds. It returns an array with the starting and ending Gtk::TextIter objects, which identify the selected text interval in the text buffer. +The other method for retrieving text iterators in our function called "retrieve_text" is Gtk::TextBuffer#bounds. It returns an array with the starting and ending Gtk::TextIter objects, which identify the starting and ending points of the entire text buffer. + +:Note: + In Gtk::TextBuffer there are three methods with a semantically similar name pertaining to((*BOUND/S*)). Do not confuse them. They are: + + * Gtk::TextBuffer::selection_bound - singular. Returns the mark that represents the selection bound, and is equivalent to calling Gtk::TextBuffer#get_mark to get the mark named "selection_bound". + * Gtk::TextBuffer::selection_bounds - plural. Obtains selected text and returns an array:((*[start, end, selected]*)) + * Gtk::TextBuffer::bounds. Retrieves the first and last iterators in the buffer, i.e. the entire buffer lies within the range [start, end]. Accordingly returns an array:((*[start, end]*)) When you have the two iterators you have to supply them to Gtk::TextBuffer#get_text(start, end, show_invisible=false), to retrieve the selection.