In Activity A I display a ScrollView of orders. User selects an order, which starts item detail activity. From here the item is DELETED, and item detail activity is FINISHED. When Activity A resumes I call my refresh routine. On the screen we see all the correct orders displayed and refresh, reflecting the removal of an order. But at the BOTTOM of the scroll view there is STILL a ghost image of the order that WAS previously display at the end. I don't understand why when Activity A resumes, and remakes the scroll view, that the visual of the old "last item in list" is still seen. Note: I can not click this ghost item to go into order edit, so I know it is merely an image.
Can't seem to figure out how to properly reset the scroll view before reloading it with a refreshed item list?
Can't seem to figure out how to properly reset the scroll view before reloading it with a refreshed item list?
B4X:
Sub Activity_Resume
Activity.LoadLayout("OrderList")
RefreshOrderList
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Activity_Create(FirstTime As Boolean)
End Sub
Sub RefreshOrderList
Dim cmd As String
Dim crs As Cursor
Dim row As Int
Dim pnl As Panel
Dim ItemCount As Int
Dim Truck As String
Truck = "Unknown"
bmDn.Initialize(LoadBitmap(File.DirAssets,"OrderDown.png"))
bmUp.Initialize(LoadBitmap(File.DirAssets,"OrderUp.png"))
bmEd.Initialize(LoadBitmap(File.DirAssets,"EditInformation.png"))
Select Case Main.OrderListMode
Case Globals.DeliveredOrders
Activity.Title = "Eljay Delivery - Delivered Orders"
cmd = "SELECT * FROM OpenOrderHeader WHERE Status = 'D' ORDER BY PresentationOrder, ShipToAddress1, OrderNumber"
Case Globals.UndeliveredOrders
Activity.Title = "Eljay Delivery - Undelivered Orders"
cmd = "SELECT * FROM OpenOrderHeader WHERE Status <> 'D' ORDER BY PresentationOrder, ShipToAddress1, OrderNumber"
Case Else
Activity.Finish
Return
End Select
ProgressDialogShow("Loading invoices for display." & CRLF & "Please wait....")
svItems.Invalidate
dragOrderManager.Initialize(Me,"dragOrderManager",svItems)
crs = Globals.Delivery.ExecQuery( cmd )
Dim start As Long = DateTime.Now
Top = Gap
Dim statusText As String
ProgressDialogShow("Loading " & crs.RowCount & " invoices for display." & CRLF & "Please wait....")
ItemCount = crs.RowCount
For row = 0 To crs.RowCount-1
Log("Retrieving row " & row)
statusText = "Loading " & (row+1) & " of " & crs.RowCount & "invoices, please wait..."
lbStatus.Text = statusText
DoEvents
crs.Position = row
Dim hdr As OpenOrderHeader
hdr.Initialize
hdr.FromCursor(crs)
hdr.PresentationOrder = dragOrderManager.svScrollView.Panel.NumberOfViews
pnl = CreatePanelForOrderHeader( hdr )
dragOrderManager.AddItem(pnl)
Truck = hdr.SalesmanName
Next
crs.Close
Dim secs As Float = ( DateTime.Now - start ) / 1000
lbStatus.Text = ItemCount & " orders for """ & Truck & """"
ProgressDialogHide
End Sub