ruby-****@sourc*****
ruby-****@sourc*****
2012年 10月 2日 (火) 02:16:23 JST
------------------------- REMOTE_ADDR = 184.145.80.187 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-addrnhs ------------------------- @@ -639,7 +639,7 @@ === Adding, Removing Rows In a Tree View & Imaginary Root Node -Finally, lets also address the two issues, mentioned earlier. The first when introducing the first version of the 'treev-MultiDim-load-asci-table.rb' program example under the title ((<"Tedious Job of Loading Multidimensional Tree Store:"|tut-gtk2-treev-trees#Tedious Job of Loading Multidimensional Tree Store>)), where we were concerned about adding and removing rows from a multi-level tree view and tree store, and the second about the 'imaginary root node' issue which we encountered in the segment called '((<"Imaginary, invisible root node"|tut-gtk2-treev-rr#Imaginary, invisible root node:>))'. +Finally, lets also address the two issues, mentioned earlier. The first when introducing the first version of the 'treev-MultiDim-load-asci-table.rb' program example under the title ((<"Tedious Job of Loading Multidimensional Tree Store"|tut-gtk2-treev-trees#Tedious Job of Loading Multidimensional Tree Store>)), where we were concerned about adding and removing rows from a multi-level tree view and tree store, and the second about the 'imaginary root node' issue which we encountered in the segment called '((<"Imaginary, invisible root node"|tut-gtk2-treev-rr#Imaginary, invisible root node:>))'. 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. @@ -647,7 +647,7 @@ {{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. Nevertheless, the bare bones of this program have already been introduced two chapters back and pointed to at the beginning of this segment. If you gave trouble understanding how the program works I suggest you have a peak back into the 'Using Tree Store' chapter as mentioned above (((<"Tedious Job of Loading Multidimensional Tree Store:"|tut-gtk2-treev-trees#Tedious Job of Loading Multidimensional Tree Store>))). +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. Nevertheless, the bare bones of this program have already been introduced two chapters back and pointed to at the beginning of this segment. If you gave trouble understanding how the program works I suggest you have a peak back into the 'Using Tree Store' chapter as mentioned above (((<"Tedious Job of Loading Multidimensional Tree Store"|tut-gtk2-treev-trees#Tedious Job of Loading Multidimensional Tree Store>))). #### path = /(.+)(:\d+)/ =~ path ? $1 : $2 #### BUG? Gtk::TreePath#up! <<< doesn't work