B4A Class HTMLElement & CSSElement Builder Classes

Discussion in 'Additional libraries, classes and official updates' started by Mashiane, Feb 2, 2017.

  1. Mashiane

    Mashiane Expert Licensed User

    Hi there...

    Well I wanted to create some HTML and CSS elements for something I am working on. Actually I'm trying to develop a webapp that will run inside a webview, just for fun. This should also execute commands and get and set data. WebViewExtras is coming handy for that.

    So instead of having to write many .Append statements, well I have a few now, I decided on some generators instead. Here we go..

    Example code...

    Code:
    Dim elem As HTMLElement
        elem.Initialize(
    "mashy","div")
        elem.ElementType = elem.EnumElementType.body
        elem.AddAttribute(
    "writes","b4a")
        elem.AddAttribute(
    "including","b4i")
        elem.AddAttribute(
    "enjoying""b4j")
        elem.AddClass(
    "loves")
        elem.AddClass(
    "what")
        elem.AddClass(
    "he")
        elem.AddClass(
    "has learned")
        elem.AddStyle1(
    "background","green")
        elem.AddStyle1(
    "width","50px")
        
    Log(elem.HTML)
    Output...

    Code:
    <body id="mashy"
    writes=
    "b4a" including="b4i" enjoying="b4j"
    class=
    "loves what he has learned" style="background:green; width:50px;">
    </body>
    The CssElement builder...

    Code:
    Dim css As CssElement
        css.Initialize(
    ".loves")
        css.AddAttribute(
    "color","white")
        css.AddAttribute(
    "background-image","mashy.png")
        
    Log(css.HTML)
    and the output...

    Code:
    .loves {color:white; background-image:mashy.png; }
    PS: By the way this is what I'm using for the AMTileView and AMRadialMenu
     

    Attached Files:

    fredo, joulongleu, peacemaker and 3 others like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice