B4J Question Listview item loaded with layout of checkbox, textfield, button addressability

Mahimahi

Member
Licensed User
I am testing loading a listview items of a layout "subLvLayout" containing a checkbox, a textfield and a button, all looks fine. (please see picture)

My question is how can these individual listview item's checkbox, textfield and button be addressed? e.g. click action, textfields' text, checkbox checked or not individually

Can someone please help give some pointers or an example? Thanks a lot in advance.
 

Attachments

  • listviewItemCbTbBtnQuestion.png
    listviewItemCbTbBtnQuestion.png
    60 KB · Views: 252

moore_it

Well-Known Member
Licensed User
Longtime User
use the events
for example :

B4X:
Sub Button_Action
dim bt as button = sender
..
..
end sub

the bt is the checked button if you use the tags yoe will be able to get the index of row in the list.
 
Upvote 0

Mahimahi

Member
Licensed User
Thanks moore_it. I assume by using tags to track index of row in the list, I would have to dim, initialize the individual controls e.g. checkbox, textfield, button in code vs. doing it in a layout/designer. Am I correct?

In a basic listview setup, an array of strings would be added and they can be addressed via ListView1.SelectedItem when a row is selected. When we are adding a few nodes like checkbox, textfield, button in the listview as an item, are we able to get all properties of nodes without user's action? e.g. without user clicking on a button or checking/unchecking a checkbox. i.e. I like to be able to go through all items on listview, get checkbox state, textfield text. Is that possible?

Please kindly advise. Thanks a lot.
 
Upvote 0

Mahimahi

Member
Licensed User
Can you help give an example of how to go through all items on listview, and get the checkbox state, textfield text? Thanks a lot.
 
Upvote 0

Mahimahi

Member
Licensed User
Thanks for the example. Although I still don't know how I can go through all items on listview, and get the checkbox state, textfield text?

If I have a button outside of listview, when clicked, I want to be able to go from listview index 0 to x where x is the number of items -1 in listview, and foreach item, I want to list out checkbox state, label text, datepicker date, etc. Your example shows event from node by getting node's parent (e.g. button), which is the pane's tag, which I understand. Can I go from listview's event "_selectedIndexChanged" and find out all child or children node's info?

Please advise. Thanks.
 
Upvote 0

Mahimahi

Member
Licensed User
Thank you very much moore_it. Your help and example is much appreciated. I am sure others can benefit a lot from your example, like I did.
 
Upvote 0
Top