|
From: <fu...@us...> - 2003-12-15 20:11:58
|
Update of /cvsroot/neelix/neelix/view
In directory sc8-pr-cvs1:/tmp/cvs-serv13260/view
Modified Files:
fox.rb
Log Message:
model.rb got a major overhaul. Took out all the commit/rollback stuff
(artifacts of an old paradigm), and tied the accessors directly to the db.
Added a nifty ObservableArray with many thanks to bartsman on #ruby-lang and a
few posts on comp.lang.ruby
The recipe name is complete in all its MVP glory. When you change the name of
the recipe in the form on the right, the variable is updated. Recipe then
notifies its observers (i.e. the FXTreeItem corresponding to the recipe) that
it has changed, and then the tree item updates with the new value.
Index: fox.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/view/fox.rb,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** fox.rb 14 Dec 2003 04:54:05 -0000 1.3
--- fox.rb 15 Dec 2003 20:11:54 -0000 1.4
***************
*** 9,12 ****
--- 9,15 ----
name = FXTextField.new(self, 80)
name.text = recipe.name
+ name.connect(SEL_COMMAND) do |sender,sel,data|
+ recipe.name = name.text
+ end
FXLabel.new(self,"Author")
***************
*** 59,63 ****
shelf = FXGroupBox.new(splitter,"Shelf",FRAME_GROOVE)
! shelf.width = 200
counter = FXGroupBox.new(splitter,"Counter",FRAME_GROOVE)
--- 62,66 ----
shelf = FXGroupBox.new(splitter,"Shelf",FRAME_GROOVE)
! shelf.width=200
counter = FXGroupBox.new(splitter,"Counter",FRAME_GROOVE)
***************
*** 71,74 ****
--- 74,78 ----
item.data = recipe
shelfTree.addItemLast(category_item, item)
+ recipe.add_observer { item.text = recipe.name; shelfTree.update }
end
end
|