At each level (commitProperties, measure, updateDisplayList), their
equivalent invalidators (invalidateProperties, invalidateSize,
invalidateDisplayList) are blocked such that work you do in those
methods will not trigger another call to those methods.  But work you do
in updateDisplayList can call invalidateSize and trigger another
measure() which could in turn call invalidateDisplayList and trigger
another updateDisplayList.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Josh McDonald
Sent: Tuesday, May 13, 2008 9:46 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Quick question - who calls
UIComponent.measure()?

 

What I meant was, I didn't want to do my sizing / positioning in a
handler that's triggered by invalidateDisplayList() - which is only
updateDisplayList() according to my limited knowledge, because I was
worried that moving or resizing a component would trigger another
invalidateDisplayList() - but it sounds like I was wrong, which is good
to know =)

Does Canvas use a LayoutManager? What's it do? Is that what interprets
the style information on the children such as top or horizontalCenter?

I'm building a component based on Canvas that never adjusts its own
measuredWidth / measuredHeight. It does only what it inherits from
Canvas, and positions all children and sets their width and height
explicitly based on its own dimenisions. Based on how I'm interpreting
your post, I shouldn't be overriding measure at all, and move my
child-position code into invalidateDisplayList()?

It's working fine now, but I hate doing things the wrong way ;-)

I tell you what, I'd sell my left nut for some flow charts of how a well
behaved complex component behaves, showing when invalidateXXX() is
flagged, and what determines whether or not things are invalidated. Does
anything that detailed exist? Would people out there find it useful if I
take a few hours to work on a preliminary one over the weekend? I know
there's a few "lifecycle of a component" articles, but I'm thinking of
something more verbose.

-J

On Wed, May 14, 2008 at 1:58 PM, Alex Harui <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:

Measure() is called on Canvas as well because a Canvas's
measuredWidth/Height are dictated by the position and size of its
children.

 

You should always measure your children in the measure() method, and
position them in updateDisplayList.  Anything you do in creationComplete
can cause something to be invalidated and cause another pass of
commitProperties/measure/updateDisplayList.

 

I'm not sure what you mean by "attached to invalidateDisplayList".  It
is possible to create invalidation loops where by the time we finish
validating, something is invalidated again.

 

________________________________

From: flexcoders@yahoogroups.com <mailto:flexcoders@yahoogroups.com>
[mailto:flexcoders@yahoogroups.com <mailto:flexcoders@yahoogroups.com> ]
On Behalf Of Josh McDonald
Sent: Tuesday, May 13, 2008 5:54 PM
To: flexcoders@yahoogroups.com <mailto:flexcoders@yahoogroups.com> 
Subject: Re: [flexcoders] Quick question - who calls
UIComponent.measure()?

 

If it's in a container that uses a LayoutManager (not Canvas IIRC), and
if the component in question isn't of a fixed size.

If you need to measure and position stuff in a component that's not
always of a fluid size, you need to move your code into another method,
and call it both from measure() and on CreationComplete and whenever you
add a component.

I'm not sure if it could be attached to invalidateDisplayList somehow,
in case you do something that triggers an endless loop ;-) It's
something I'll look into when I have more time, as I'm doing all my
component adding in createChildren() and haven't had to deal with post
CreationComplete changes.

Alex, please correct me if I'm wrong in there somewhere, too!

-J

On Wed, May 14, 2008 at 10:18 AM, Mansour Raad <[EMAIL PROTECTED]> wrote:

Question - is it part of the lifecycle of the component ?

Mansour
:-)



-----Original Message-----
From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
on behalf of Alex Harui
Sent: Tue 5/13/2008 8:07 PM
To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 

Subject: RE: [flexcoders] Quick question - who calls
UIComponent.measure()?

It is called by LayoutManager via validateSize()

________________________________

From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
Behalf Of Josh McDonald
Sent: Tuesday, May 13, 2008 4:33 PM
To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
Subject: [flexcoders] Quick question - who calls UIComponent.measure()?

Hey guys,

Since UIComponent.measure() is protected, does the container invoke it
via a round-about way, or is it simply called from a ResizeEvent.RESIZE
handler somewhere in UIComponent?

-J

-- 
"Therefore, send not to know For whom the bell tolls. It tolls for
thee."

:: Josh 'G-Funk' McDonald

:: 0437 221 380 :: [EMAIL PROTECTED] <mailto:josh%40gfunk007.com>
<mailto:[EMAIL PROTECTED] <mailto:josh%40gfunk007.com> > 




-- 
"Therefore, send not to know For whom the bell tolls. It tolls for
thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  




-- 
"Therefore, send not to know For whom the bell tolls. It tolls for
thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  

 

Reply via email to