Skip to content

Commit

Permalink
Merge pull request #244 from georgejecook/fix/duplicate-delegate-even…
Browse files Browse the repository at this point in the history
…t-hardenning

fixes focusing on illegal item when removing last item in a row
  • Loading branch information
georgejecook authored Aug 1, 2022
2 parents 88797f1 + 15df23a commit e0f53f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions src-ml-test-app/source/main/DeveloperScreen.bs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace main
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
protected function getPage2()
return [
["List Editing (team screen)", function(): m.showScreen(m.createSGNode("TeamScreen")): end function]
["Grid Item JumpToItem", function(): m.showScreen(m.createSGNode("FocusOnGridItemScreen")): end function]
["Grid Item Moving", function(): m.showScreen(m.createSGNode("UpdateGridItemsScreen")): end function]
["List Updates", function(): m.showScreen(m.createSGNode("UpdateListDataScreen")): end function]
Expand Down
7 changes: 6 additions & 1 deletion src/source/ml/ItemDelegateMixin.bs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ namespace ml.itemDelegateMixin
if m.listEventMap = invalid
m.listEventMap = {}
end if
m.__lastMaestroEventName = ""

if instance = invalid
instance = m
end if
Expand Down Expand Up @@ -70,8 +72,11 @@ namespace ml.itemDelegateMixin
else if eventName = "gainingFocus" or eventName = "losingFocus"
m.listItemDelegate[m.listEventMap[eventName]](event.direction, event.fraction)
else
m.listItemDelegate[m.listEventMap[eventName]](event.direction)
if eventName <> m.__lastMaestroEventName
m.listItemDelegate[m.listEventMap[eventName]](event.direction)
end if
end if
m.__lastMaestroEventName = eventName

end function

Expand Down
7 changes: 4 additions & 3 deletions src/source/ml/RowItemViewManager.bs
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,16 @@ namespace ml
m.updateRenderedComponents(m.direction, m.itemScroller.index, true)
m.itemScroller.getComponentInfos(true)
m.itemScroller.processChanges(changes)
' ? " LLLL " ; m.itemScroller.numberOfComponents ; " ONC " ; oldNumComponents
' ? " LLLL " ; m.itemScroller.numberOfComponents ; " ONC " ; oldNumComponents ; " FI "; m.itemScroller.index
m.rowInfos = invalid
if (m.itemScroller.numberOfComponents = 0 and oldNumComponents > 0) or (oldNumComponents = 0 and m.itemScroller.numberOfComponents > 0)
' ? "::::::::::::::::: SUB ITEMS ZERO CHANGE - TELL LIST"
m.owner@.forceUpdate()
end if
if m.row.isFocused
' m.itemScroller.forceFocusOnIndex(m.itemScroller.index)
m.owner.focusedCellIndex = m.itemScroller.index
' ? " IS FOCUSED ON" ; m.itemScroller.index
m.itemScroller.moveToIndex(m.itemScroller.index, false)
m.itemScroller.forceFocusOnIndex(m.itemScroller.index)
end if
end function

Expand Down

0 comments on commit e0f53f8

Please sign in to comment.