B4J Question [SOLVED] [BANano] Creating CustomListView with UL/LI and using Input Control Events

Mashiane

Expert
Licensed User
Longtime User
Hi

I am using BANano.LoadLayoutArray to create a custom view. This is basically ul/li components with input components.

1697718453341.png


B4X:
<div id="sduicol3_6" class="col pr-4 pl-4 xs:col-span-3 sm:col-span-3 md:col-span-3 lg:col-span-3 xl:col-span-3 col-span-3"><input name="toggle1_6" type="checkbox" id="toggle1_6" class="toggle"></div>

I have assigned a change event to the checkbox input element and trapping the Sender. I cant have this working with getChecked / setChecked event.

Could the sender be picking up the "parent" of the respective node that is changed?

I will see if I can reproduce this with native html components..
 

Mashiane

Expert
Licensed User
Longtime User
Use Case 1

1697720830080.png


As an example, in the example below, I click a child item in a list and trap with _itemclick.

B4X:
Sub sduimenu1_itemclick(e As BANanoEvent)
    Log(e)
    Dim menuitem As SDUIMenuItem = Sender
    Log(menuitem)
    SDUIMDToast1.ShowInfo(menuitem.Tag)
End Sub

The log of e below, indicates that a child item was indeed clicked as per target.

1697720547693.png


Defined as

B4X:
<li id="menuitem_5"><a id="menuitemanchor_5"><p id="menuitemtitle_5" class="text-2xl font-bold">Item - E</p></a></li>

MenuItem.gif


The Sender returned is indeed the menuitem_5, which works well with this use case.
 
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
Use Case 2

1697720927578.png


Output

1697720959586.png


Now when I click the button / change the checkbox. The Sender does not return the clicked element (i.e button), but the something else, its like the parent div.

B4X:
<div id="sduicol2_7" class="col pr-4 pl-4 xs:col-span-4 sm:col-span-4 md:col-span-4 lg:col-span-4 xl:col-span-4 col-span-4"><button id="button1_7" class="btn normal-case btn-wide btn-neutral" data-color="btn-neutral"><span id="button1_7_text">B</span></button></div>

Not sure if anyone has experienced this, I would like to get a work-around.
 
Upvote 0
Top