On 5/18/05, Erik Westra <[EMAIL PROTECTED]> wrote:

>         _measuredMinWidth
>         _measuredMaxWidth
>         _measuredMinHeight
>         _measuredMaxHeight
>         _measuredPreferredWidth
>         _measuredPreferredHeight
>         The properties define limits for when the object is resized.
>         These measured properties are used for layout in containers
>         if your component doesn't explicitly set a preferredWidth or
>         preferredHeight attribute.
> 
> I think this information is missing the part where they explain what
> function these properties have exactly.

In your component's measure(), you set the "_measured" properties.

  public function measure():Void
  {
    _measuredPreferredWidth = 200;
    _measuredPreferredHeight = 100;
  }

Now see what happens when you use the component without specifying any
width and height:

  <Application>
    <MyComponent />
  </Application>

The application will size to {200,100} because that's the preferred
size of the MyComponent instance.  How does the layout mechanism know
{200,100} is the preferred size?  MyComponent calculates it (or, in
our example, hardcodes it) in its measure()

If, however, you set an explicit size for the component, the size is respected:

  <Application>
    <MyComponent width="100" height="300" />
  </Application>

The size is set to {100,200}, ignoring the measured preferred size.

Similarly _measureMinWidth, _measuredMaxWidth, etc., are set
internally and used when minWidth, maxWidth, etc., have not been
explicitly specified.

You can think of the "_measured" variables as the automatically
measured versions of their public counterparts (width, minWidth,
maxWidth, etc.).

> >Then you can open the MyMXMLFile-generated.as file to see the
> translated
> >AS code.  Look for "Descriptor" in that file to get an idea.
> 
> Yeah I have seen these pieces of code. I was however wondering how I
> this information was processed internally so I could create my own
> version for that. In some cases its preferable to create these childs
> not directly into the component but into a holder. For the developer
> using your component it should look like the children of the component
> itself.

Can you elaborate?  This would be possible in Flex without going into
the details of how UIObjectDescriptor's are set up internally.

> >When you resize a child in the box, its parent's "layout" needs
> >to be redone, so Flex remembers this and calls the parent's
> layoutChildren()
> >on the next frame.  In the layoutChildren() of the Box container, it
> >calculates the sizes of its children and lays them out accordindly.
> >
> >This happens for any Container, not just Box.
> 
> U say "Flex remembers this", but how is it done? Via an event? I mean
> how does the parent container know one of its children is resized? Is it
> automaticly registering itself as listerer for the size event?

How does a program "remember" something?  By storing it in a variable.

The framework automagically handles this for every component.  I can't
go into implementation details for various reasons, but just know
that, when a component is resized, its parent has to do a re-layout
(layoutChildren())


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to