Wish [BANano] getter for AutoID generated value

alwaysbusy

Expert
Licensed User
Longtime User
Can you give me an example why you would need that? If the event is defined in the custom view the event will stll be raised on the original name. You can then just use the ID property to find out on which element the event was raised.

From your demo 01, e.g. original name was divchild4 with event click:

B4X:
Private Sub divchild4_Click (e As BANanoEvent)
    Dim elem As SHIonBaseElement = Sender
    Log(elem.ID) ' <------ the auto generated ID e.g. afgdrpgh_4
    Log(e)
End Sub

Alwaysbusy
 

Mashiane

Expert
Licensed User
Longtime User
Dim elem As SHIonBaseElement = Sender
Wow, thank you so much. I need to remember this.

I was executing the setText call as I wanted to change the text in the component. I was hoping that I can update both text and styles

I appended the code a little after the mTarget.Append call

B4X:
 mElement = mTarget.Append($"[BANCLEAN]<${sCustomTag} id="${mName}" ${se.exAttrs} ${se.exAttrs1}>${sText}</${sCustomTag}>"$).Get("#" & mName)
'
with..

B4X:
    If mName.EqualsIgnoreCase("lblAssign") Then
        Log($"Element...${mName}"$)
        Log(mElement)
    End If

The latter does not get executed for the AutoID elements. Perhaps if possible to have a way to re-assign the element and I thought perhaps getting the new id would just help one to re-initialize it or something.
 

Attachments

  • Demo02.zip
    13.2 KB · Views: 62
Top