On 11/12/16, 8:45 AM, "carlos.rov...@gmail.com on behalf of Carlos Rovira"
<carlos.rov...@gmail.com on behalf of carlosrov...@apache.org> wrote:

>Hi Alex,
>
>I think the way you allowed html text in js:Button was adding only
>
>    [DefaultProperty("text")]
>
>right? is needed something more?
>
>I think this would be needed in most controls and Containers.
>For example js:Container has already [DefaultProperty("mxmlContent")]
>
>Could we have the possibility to add either html text or mxml content?
>
>I think this will improve a lot the things user can do.
>

What would the text/html property do on a Container?  The basic container
doesn't automatically contain a way to display text/html, it just contains
an arbitrary set of children.  Sure, container happens to be a div in the
browser, but I don't think you can count on that in other platforms
forever.

That said, I think you may be right that you can't use xhtml tags as the
value of the "html" property.  Please try it and if it doesn't work, file
a bug.

What [DefaultProperty] does is essentially inject a tag in mxml.  For
example, an container really does have an mxmlContent property.  So when
you write:
   <js:Container>
     <js:Label />
   </js:Container>

The actual MXML parse tree is:

   <js:Container>
     <js:mxmlContent>
       <fx:Array>
         <js:Label />
       </fx:Array>
     </js:mxmlContent>
   </js:Container>

That's why you can't have two default properties.  Or maybe shouldn't.  I
suppose we could and have the compiler guess based on the type of the
child tags, but that doesn't seem right.


So anyway, what should work is in-line xhtml as the value of the html
property.  IOW a plain text label should look like the following MXML:

  <js:Button text="plain text label"/>

For a simple html label, you should be able to do:

  <js:Button text="this is an <b>html</b> label"/>

And this should also work, with or without [DefaultProperty]


  <js:Button>
    <js:html>
      <h1>My Fancy Button</h1>
      <p>With <span>this label</span></p>
    <js:html>
  <js:Button>

If these don't work, file bugs and well get them to work.

[DefaultProperty] just saves you from having to type some inner tags.

HTH,
-Alex

Reply via email to