B4J Question [BANano] (Render)Append returns the wrong BANanoElement?

Kiffi

Well-Known Member
Licensed User
Longtime User
Hello,

i'm not sure if this is a bug:
B4X:
Dim myBANanoElement As BANanoElement
   
myBANanoElement = BANano.GetElement("body")
Log(myBANanoElement) ' -> body-Element (correct)

myBANanoElement = BANano.GetElement("body").Append($"<div></div>"$)
Log(myBANanoElement) ' -> also body-Element (shouldn't this be a div-Element?)

When i take a look at the Demo-Codes posted here, i see:
B4X:
Public Sub Button(TargetID As String, ID As String, Text As String, ColorVariant As String, EventHandler As Object)
    Dim btn As BANanoElement = BANano.GetElement(TargetID.ToLowerCase)
    btn.RenderAppend($"<button id="${ID.ToLowerCase}" class="${ColorVariant}">${Text}</button>"$,"")
    ' defining events is very simple. Note that it has to be run AFTER adding it to the HTML DOM!
    ' eventName must be lowercase!
    btn.HandleEvents("mousedown, touchstart", EventHandler, "buttonclicked")
End Sub

Here the mousedown/touchstart event is assigned to the body.
But I think that it was planned to assign these events to the button element.

Thanks in advance & Greetings ... Peter
 
Top