If it doesn't need to truly float, consider using states and 
addChild/removeChild

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Michael 
Prescott
Sent: Tuesday, December 09, 2008 5:59 AM
To: [email protected]
Subject: Re: [flexcoders] Defining, but not adding to parent in MXML


That's it exactly.  Basically, we have a number of situations where we need to 
add pop-up details to elements in our application, so I thought I'm trying to 
make reusable non-visual component that orchestrates that, like this:

<mx:Whatever id="summary"/>

<mx:Canvas id="myPopUp">
  <mx:Label text="All sorts of useful information"/>
</mx:Canvas>

<my:PopUpDetail
    target="{summary}"
    popUp="{myPopUp}"
    popUpOnRollover="true"
    popUpOnFocus="true" />

So I've dug around in PopUpButton to see how it manages its pop-up, and that 
looks simple enough.  But PopUpButton uses the existence of popUp.parent to 
determine whether it is managing the pop up yet (no parent, and it assumes that 
it isn't) - so it seemed that, along with my not knowing about 
includeInLayout="false", creating the popup control in some sort of parentless 
way was important.

Michael

On Tue, Dec 9, 2008 at 1:33 AM, Josh McDonald <[EMAIL PROTECTED]<mailto:[EMAIL 
PROTECTED]>> wrote:

I think he's intending to use PopupManager, but wants to define it in the same 
file as its container?

On Tue, Dec 9, 2008 at 4:30 PM, Alex Harui <[EMAIL PROTECTED]<mailto:[EMAIL 
PROTECTED]>> wrote:

Why not use tooltip or popup manager to float that thing?  Then it won't be 
clipped and what not



From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]<mailto:[email protected]>] On 
Behalf Of Josh McDonald
Sent: Monday, December 08, 2008 5:04 PM
To: [email protected]<mailto:[email protected]>
Subject: Re: [flexcoders] Defining, but not adding to parent in MXML



That's not exactly what you're after, in this case the object will be added to 
the list of children, it's just not positioned on parent.updateDisplayList() or 
counted during parent.measure().

The only way I can think of off the top of my head to do what you're after is 
wrap it in <mx:Array>. Here's a quick example:

http://pastie.textmate.org/private/hjd33kkztkuojpzltd2ylw

You can use <mx:component> to do thins kind of like this, but <mx:component> 
defines classes,  not interfaces, and IIRC, mxmlc is kinda picky as to where 
it'll let you do it.

-Josh

On Tue, Dec 9, 2008 at 10:53 AM, Michael Prescott <[EMAIL 
PROTECTED]<mailto:[EMAIL PROTECTED]>> wrote:

Sweet!  Nice that there's an easy answer.



On Mon, Dec 8, 2008 at 4:47 PM, Tracy Spratt <[EMAIL PROTECTED]<mailto:[EMAIL 
PROTECTED]>> wrote:

includeInLayout="false" (also visible="false", of course)



Tracy



________________________________

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]<mailto:[email protected]>] On 
Behalf Of Michael Prescott
Sent: Monday, December 08, 2008 4:28 PM
To: [email protected]<mailto:[email protected]>
Subject: [flexcoders] Defining, but not adding to parent in MXML



Is it possible to define a component but somehow cause it to be omitted from 
the enclosing component's list of children?  Essentially:

<mx:VBox>
  <mx:Label text="This is added as a child of the vbox, as normal."/>
  <mx:Label visible="false" text="This is invisible.. but is there some way to 
not have it be a child of the vbox at all?"/>
</mx:VBox>

An obvious question is, "Why are you defining the component there if it's not 
supposed to be a child?"

I've got a datagrid inline item renderer that always shows a (summary) piece of 
information, but I want a pop-up to appear on rollover of the summary.  The 
problem I'm having is that the detail is (of course) added to the container 
that holds the summary, which causes the datagrid cell to blow open too big.

<mx:itemRenderer>
  <mx:Component>
    <mx:Box>
      <!-- This always shows up, which is fine and dandy -->
      <mx:MySummary data="{data}"  popUp="{detail}" />

      <!-- It would be nice if this was never added to the parent box, so that 
it's free to be used as a popup -->
      <mx:MyDetail id="detail" data="{data}"/>
    </mx:Box>
  </mx:Component>
</mx:itemRenderer>

Defining the detail outside the itemrenderer entirely seems one way to go, 
except that this would mean there's only one pop up for all of the rows of the 
data grid.

Can you do this sort of thing with a nested component?

<mx:itemRenderer>
  <mx:Component>
    <mx:Box>
      <!-- This always shows up, which is fine and dandy -->
      <mx:MySummary data="{data}">
        <mx:popUp>
          <mx:Component>
            <mx:MyDetail id="detail" data="{data}"/>
          </mx:Component>
        </mx:popUp>
      </mx:MySummary>
    </mx:Box>
  </mx:Component>
</mx:itemRenderer>

Any tips would be appreciated!

Michael





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

Like the cut of my jib? Check out my Flex blog!

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>
:: http://flex.joshmcdonald.info/
:: http://twitter.com/sophistifunk



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

Like the cut of my jib? Check out my Flex blog!

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>
:: http://flex.joshmcdonald.info/
:: http://twitter.com/sophistifunk


Reply via email to