B4J Question [BANano] [SOLVED] How do I load different layouts to the same #id?

Mashiane

Expert
Licensed User
Longtime User
Ola

I'm trying to load different layouts with LoadLayout but to the same location so that one is "appended" one after another as one would BANano.GetElement(?").Append(???)

B4X:
BANano.loadlayout("#container", "alerts")
BANano.loadlayout("#container", "lybuttons")

It seems like the latter replaces the former.

I've just tried

B4X:
BANano.LoadLayoutArray("#container", "alerts", True)
BANano.LoadLayoutArray("#container", "lybuttons", False)

though I know that's for the same layout - thought i could be lucky?

Thanks
 

alwaysbusy

Expert
Licensed User
Longtime User
BANano.LoadLayout works like the normal B4X LoadLayout
BANano.LoadLayoutArray can work like you did but will add indexes to the ids

The correct way would be making a placeholder layout and then load the different layouts in them

v5 will have a LoadLayout/LoadLayoutArray on the BANanoElement level, so this will be possible:
B4X:
    Dim body As BANanoElement
    body.Initialize("#body")    
        
    body.Append($"<div id="pageHolder"></div>"$).Get("#pageHolder").LoadLayout("MainLayout2")
    body.Append($"<div id="modalHolder"></div>"$).Get("#modalHolder").LoadLayout("Modal1")

    SKMobileNav1.GetButtonContents(0).LoadLayout("Users")    
    SKMobileNav1.GetButtonContents(1).LoadLayout("Cases")

Alwaysbusy
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
I hope all these great questions asked and expert answers provided are being documented as a BANono for dummies tutorial!
From what I see it my require a high level knowledge in JS which blends into how to apply to BANano... I DONT KNOW....

When i look at:
" body.Append($"<div id="pageHolder"></div>"$).Get("#pageHolder").LoadLayout("MainLayout2") "
What the heck does that mean or do???

You people work in a space well beyond my scope, and quite frankly, I don't want to go there to create what I need...
Maybe someday - but not soon.

First, as I figure, I must know the other 4 letter foul languages to even grasp the concept. Not happening soon for me...

Thankfully I (we) got ABMaterial that does all the dirty work (without me knowing a freakin thing) ...

Sometimes, the way we utilize B4X (J) is less of a science, but more magic (ABM is a prime example).

It works without us ever understanding how or why... A really GOOD thing.. How can you ever fault that....

Thanks
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
@Harris This is indeed why I wrote ABM: for those who don't (want to) care about html/javascript/css and just want to write plain old fun B4J code. ;) ABM takes care of you on so many levels, something in BANano you have to do all by yourself. Two different libs, two different audiences...
 
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
BANano for dummies tutorial!
I'm sure as soon as I become a BANano Abstract Designer ninja I will add a lot more to the tutorial. LOL. Its only now that I'm starting to even create custom views and use the AD on a serious note. Falling inlove with the process, but then for that one needs to wear a designer hat first because the coding will be very minimal in some extents.
 
Upvote 0
Top