DonManfred & Klaus
Thanks for your persistent efforts, after working through DonManfreds examples I went back to Klaus's examples and after re-wiring my brain it finally came together. For completeness and hopefully help to others, is a "trimmed" version of my resulting code.
Firstly I was trying to replace the combination of List&Inputlist with Listview.
It should have been replace List&InputList with List&Listview&Listview_ItemClick.
Sub Process_Globals
Dim History As List 'List where data is stored
Dim Value as Double ' Used to pass values from program to List and from ListView to program
...
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim HistoryView As ListView 'Basically a mechanism for displaying data from a List, Array, Map Etc.
...
End Sub
Sub Activity_Create(FirstTime As Boolean)
History.Initialize
History.InsertAt(0, 0) 'Puts a "start" value on the stack
HistoryView.Initialize("HistoryView")
....
End Sub
Sub StackPush
History.InsertAt(0, Value) 'Pushes value on to top of stack
If History.Size > 15 Then
History.RemoveAt(15) ' Removes value at bottom of stack to limit stack size
End If
End Sub
Sub Stackrecall2
Dim Temp As Double
Dim HistLabel As Label 'Set the parameters for displaying the Items of the ListView
HistLabel = HistoryView.SingleLineLayout.Label '
HistLabel.TextSize = 20 '
HistLabel.TextColor = Colors.White '
HistLabel.Color = Colors.Transparent '
HistLabel.Height = 30dip 'Label height and Item Height should match to avoid gaps & overlaps
HistoryView.SingleLineLayout.ItemHeight = HistoryView.SingleLineLayout.Label.Height
HistoryView.Color = Colors.Black 'ListView color matches Label color as labels don't fill ListView
HistoryView.ScrollingBackgroundColor = Colors.Blue
HistoryView.Clear 'Clear Listview before populating or else you get duplicates
For i = 0 To History.Size - 1 'Builds the viewable list HistoryView from the List "History"
Temp = History.Get(i) 'Get the value from the List
HistoryView.AddSingleLine(Temp) 'Store the value in the ListView
Next
Activity.AddView(HistoryView, 0, 0, 100%x, 100%y) 'Displays the list built by the previous loop.
End Sub
Sub HistoryView_ItemClick (Position As Int, HistValue As Object)
Value = HistValue 'Capture the value retrieved from ListView for use elsewhere.
HistoryView.RemoveView 'Exit ListView.
End Sub
Please let me know if the code shows I have the wrong idea about something
Thanks again Guys
Regard Roger