Android Question Getting the Control Name

Discussion in 'Android Questions' started by Brad Henderson, May 21, 2019.

  1. Brad Henderson

    Brad Henderson Member Licensed User

    I am new to B4A but am loving it so far. I'm stuck on trying to find which scrollview has issued the cell_click event.
    I have 5 scrollviews(with 3 columns) and when any item in any of the scrollviews is clicked I assign a label to the sender. While label.text gives me the contents of that cell I can't find a way to get the name of the scrollview that was clicked.
    Any help is greatly appreciated
    Brad
     
  2. sorex

    sorex Expert Licensed User

    you should enter a value in the tag element of the scrollview.

    then in your label click event you could try something like

    Code:
    Dim l As Label=Sender
    log(l.Parent.Tag)
    as it is a scrollview you might need to add the tag value to the inner panel.
    you'll need to test that so it might be this if added to the scrollview itself

    Code:
    l.Parent.Parent.Tag
     
    Last edited: May 21, 2019
    mangojack likes this.
  3. Brad Henderson

    Brad Henderson Member Licensed User

    Thank You sorex I will give it a try
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Tip: you should probably use xCustomListView instead of ScrollView.
     
  5. Brad Henderson

    Brad Henderson Member Licensed User

    Thanks Erel I will have another look at xCustomListView. As an aside I am trying to adapt the TableExample that places a table in a panel within the scrollview.

    Almost at where I want it, but just can't find a way to determine from which table/panel/scrollview the cell_click event was initiated.
     
  6. Brad Henderson

    Brad Henderson Member Licensed User

    Erel,
    What I am trying to achieve is to display a week of appointments for customers showing 5 separate "views" for each day. Each day will need to be scrollable to fit onto the tablet with landscape view. When these 5 days of appointments are displayed I want to click/tap on one particular entry/customer and start a new activity displaying that customers details. This data is coming from a sqlite database.
    Do you think the xCustomlistView is the appropriate resource for this?

    Thanks again
    Brad
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    I'm not sure that I understand the required layout. Do you need it to be scrollable both horizontally and vertically? If so then search for ScrollView2D.
     
  8. Brad Henderson

    Brad Henderson Member Licensed User

    Thanks Erel
    Just need to scroll vertical on each of the five views. Will look into scrollview2D and 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