ruby-****@sourc*****
ruby-****@sourc*****
2012年 10月 2日 (火) 01:46:08 JST
------------------------- REMOTE_ADDR = 184.145.80.187 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-addrnhs ------------------------- @@ -643,4 +643,12 @@ The last, 'imaginary root node issue', we have also seen in the above (adding-n-removing-rows.rb) example program, though we did not really expose it. But it will become much more obvious in the next example, when discovering that there exist no way that would allow us to add or create the top level tree view entries. As promised this last example is the extension of the 'treev-MultiDim-load-asci-table.rb' program in which we loaded the tree model and view, from the asci table residing in the separate file as the Ruby module called 'initialize-products-from-asci-table.rb'. We are going to use the same module file here too. What is new is the feature that allows us to add and remove rows. This time however, we use a different row selection mechanism than in the above (adding-n-removing-rows.rb) example program. In this program, when we insert or delete a row, we point to it by clicking on it. When adding a row we are adding a single child to an existing parent row. When remov ing a row, we are removing the selected row and all its children, as well as all children of children, if they exist. + + +{{image_right("mD-asciTab-rmNadd-products-s1.png")}} + +Before we look at this program more closely, let me first expose its obvious flaws. The most obvious one is the awkward dialogue mechanism used to add and remove new products. A more appropriate thing to do would be to employ a context menu on which the addition and removal would be two separate choices. However, we have not yet introduced the context menu widget, and hence, instead used what you should already be familiar with. Also, we did not care to ensure the parent rows did not allow price column to be filled initially. And the most obvious flaw is that we do not provide a way to enter another top level product. All these issues can be easily fixed, however, the implementation of these fixes would greatly obscure the basic issues we are trying to present in the first place. + + + #### path = /(.+)(:\d+)/ =~ path ? $1 : $2 #### BUG? Gtk::TreePath#up! <<< doesn't work