Android Question customlistview set panel view

Discussion in 'Android Questions' started by Amateurtje, May 24, 2018.

  1. Amateurtje

    Amateurtje Member Licensed User

    Dear all,

    I am working with a customlistview with severla edittextboxes, buttons etc. when entering from one editbox to another, I want to make from the enterpressed command on the last textbox that he jumps to the first of the following panel.

    There is a getpanel command but is there also a set panel command?

    I use the fieldorder command of steve05 and this works perfectly. I set it on repeat and it starts at the front again but of the same panel. When I set it to false, it stops (logically).

    I have seen the commnad, jumptoview and scrolltoview. this does not seem to do anything but that is probable because I only have 3 panels and there is nothing to scroll…. But it does not activate the panel, only scroll to it, isn't it?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You don't need a SetPanel method.

    All that you need is:
    Code:
    Sub Activity_Create(FirstTime As Boolean)
       
    Activity.LoadLayout("1")
       
    For i = 1 To 20
           
    Dim p As B4XView = xui.CreatePanel("")
           p.SetLayoutAnimated(
    000100%x80dip)
           p.LoadLayout(
    "Cell")
           p.GetView(
    0).Text = i
           CLV1.Add(p, 
    "")
       
    Next
       
    Dim acc As Accessiblity
       acc.SetNextFocusDown(p.GetView(
    0), CLV1.GetPanel(0).GetView(0))
    End Sub
    Cell is a layout file with a single EditText.
    This code is based on xCustomListView.
     
  3. Amateurtje

    Amateurtje Member Licensed User

    hi Erel,

    Sorry, I am still a newbe...I used the customlistview code and try to do what you suggested but nothing changed.. did I do it correct?

    in the next script I got data from a csv file and putting them in the panels. Row(0 to 1) I added to the stndard createlistitem script to implement the tekst in the editboxes that i put in the panel.


    Code:
    For i = 0 To List1.Size - 1
         
    Dim Row() As String
         Row = List1.get(i)
         
    Dim pnl As Panel = CreateListItem($"Item #${i}"$, clv2.AsView.Width, 70dip,Row(0),Row(1),Row(2))
         clv2.Add(pnl, 
    70dip$"Item #${i}"$)
     
    Next
     
    Dim acc As Accessiblity
     acc.SetNextFocusDown(pnl.GetView(
    0), clv2.GetPanel(0).GetView(0))
    ps, it is a numeric edittextbox. Does the enterpress also generate a down key?
     
    Last edited: May 24, 2018
  4. Erel

    Erel Administrator Staff Member Licensed User

    The first step is to switch to xCustomListView.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice