B4J Code Snippet Move rows between two TableViews via doubleclick

With this two subs you can move rows very easy between to TableViews by doubleclicking a row. So if you doubleclick a row it is added to the second TV and deleted from the first (and vice versa). The doubleclick is checked by the ClickCount event (= 2 = two clicks = doubleclick).


B4X:
Sub CheckedOutItemsTV_MouseClicked (EventData As MouseEvent)
    If EventData.ClickCount = 2 Then
        Dim row() As Object = CheckedOutItemsTV.Items.get(CheckedOutItemsTV.SelectedRow)
        BillTV.Items.Add(row)
        CheckedOutItemsTV.Items.RemoveAt(CheckedOutItemsTV.SelectedRow)
    End If
End Sub

Sub BillTV_MouseClicked (EventData As MouseEvent)
    If EventData.ClickCount = 2 Then
        Dim row() As Object = BillTV.Items.get(BillTV.SelectedRow)
        CheckedOutItemsTV.Items.Add(row)
        BillTV.Items.RemoveAt(BillTV.SelectedRow)
    End If
End Sub
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…