ruby-****@sourc*****
ruby-****@sourc*****
2012年 9月 15日 (土) 09:47:14 JST
------------------------- REMOTE_ADDR = 184.145.80.187 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-txtw-itrsmrks ------------------------- @@ -210,7 +210,7 @@ I have also included two simple debugging code segments, to additionally expose the use of Gtk::TextIter and Gtk::TextMark objects. You may have noticed that it is very easy to obtain or convert a((*mark*))to an((*iter*))with Gtk::TextBuffer#get_iter_at_mark(mark), and that there is no equivalent feature to convert an iter to mark, though you can always create a new mark from an existing iter with Gtk::TextBuffer#create_mark(mark_name, iter, left_gravity). The debug sections also show you how the values of iterators change when you delete or insert text by printing byte offset boundaries for the selection in the text buffer, i.e. selection we are replacing with the text entered in the entry widget. -But more important is the part demonstrating steps taken to replace the highlighted selection in the text buffer, where we first, if the((*selected*))flag is returned by Gtk::TextBuffer#selection_bounds, delete the selection in the text buffer, retrieve now by the deletion invalidated iter from the mark, and then use it to insert the string from entry widget. +But more important is the part demonstrating steps taken to replace the highlighted selection in the text buffer, where we first, if the((*selected*))flag returned by Gtk::TextBuffer#selection_bounds contains true delete the selection in the text buffer, retrieve now by the deletion invalidated iter from the mark, and then use it to insert the string from entry widget. {{br}}