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

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 9月 15日 (土) 09:51:35 JST


-------------------------
REMOTE_ADDR = 184.145.80.187
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-txtw-itrsmrks
-------------------------
@@ -208,7 +208,7 @@
 
 Now that we have learned the basics, let us look at the revised "iterators.rb" example which, in addition to simple insertions at a single selected location, also deals correctly with some arbitrarily selected text. That is, you can highlight a block of consecutive characters and replace them with the text from the Gtk::Entry widget when clicking "Insert" button. The solution with buttons is not the proper way to implement this feature (more appropriate would be the use of some kind of context menu), however, the mechanics of replacing selected text using of text buffer marks and iters would be identical.
 
-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.
+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 character 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 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.
 




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