Update of /cvsroot/neelix/neelix/view
In directory sc8-pr-cvs1:/tmp/cvs-serv8196/view
Modified Files:
fox.rb
Log Message:
nicer selection code
Index: fox.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/view/fox.rb,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- fox.rb 22 Dec 2003 23:37:58 -0000 1.13
+++ fox.rb 22 Dec 2003 23:44:48 -0000 1.14
@@ -112,18 +112,20 @@
end
@ingredientList.connect(SEL_SELECTED) do |sender,sel,data|
- @up.enabled = (data != 0)
+ @up.enabled = data unless data == 0
@delete.enabled = true
+ @ingredientList.setCurrentItem(data)
+ end
+
+ @ingredientList.connect(SEL_COMMAND) do |snd,sel,data|
+ @ingredientList.selectItem(data)
end
@up.connect(SEL_COMMAND) do |sender,sel,data|
- selectedIndices = (0 .. @ingredientList.numItems-1).select do |i|
- @ingredientList.itemSelected?(i)
- end
- if not selectedIndices.empty? then
- index = selectedIndices.first
+ index = @ingredientList.currentItem
+ if index > 0
Presenter::promoteIngredient(@recipe, index)
- @ingredientList.selectItem(index - 1, true)
+ @ingredientList.selectItem(index - 1,true)
end
end
|