Get parent container size in renderer?

Hi,
I'm trying to add a variable number of same-sized Canvas
squares to the HorizontalList below:
<mx:HBox width="100%" height="50%" >
<mx:HorizontalList height="100%" width="60%"
dataProvider="{myData}"
itemRenderer="renderers.Topic" >
</mx:HorizontalList>
<mx:Canvas height="100%" width="40%" >
</mx:Canvas>
</mx:HBox>
I want the squares to be proportional such that as the app is
resized, the squares also grow or shrink in size. My item renderer
gets the size of the parent HorizontalList (via
BaseListData.owner.width) in order to calculate the dimensions of
each canvas square; as the app is resized, the size of the parent
changes and my square's dimensions are recalculated. However, it
seems that the size of the parent container isn't know until I
render some content but I can't render content until I know the
amount of real estate available in the parent. I missing something
basic here, right?
Thanks, Garry

Turn it around. Instead of having the item renderer calculate
its width based on it's parent's width, have the HorizontalList set
the size of its children in updateDisplayList().

Similar Messages

  • ABAP: Get parent container

    Hello,
    In my action handler method I have an ID of the element that triggered this event, lets call it ELEMENT_A.
    I need to get UI element (let's call it container_element) that contains ELEMENT_A.
    I know that this container_element is type of cl_wd_transparent_container.
    How can this be done?
    Thank you.

    Hi Georgy,
    You could get reference to the UI element and then use GET_PARENT method to get the container. Ofcourse, you should use VIEW for this.
    I have successfully used the following code to get refernce of a dropdown in a table. On similar lines, I guess you could get the container refernce.
    data wd_table_cell_editor type ref to cl_Wd_view_element.
      data wd_table_column      type ref to cl_wd_table_column.
    wd_table_cell_editor ?= wd_this->m_view->get_element( ID ).
      wd_table_column ?= wd_table_cell_editor->get__parent( ).
    DATA: THE_TABLE_CELL_EDITOR type ref to CL_WD_DROPDOWN_BY_KEY,
    dropdown_value type string.
    THE_TABLE_CELL_EDITOR ?= wd_table_column->GET_TABLE_CELL_EDITOR( ).
    CALL METHOD THE_TABLE_CELL_EDITOR->GET_SELECTED_KEY
    EXPORTING
       CONTEXT_ELEMENT        =
       CONTEXT_NODE_PATH_NAME =
      RECEIVING
        VALUE                  = dropdown_value.
    I have declared M_VIEW as an attribute(TYPE REF TO IF_WD_VIEW) in my view and used the following code in WDDOMODIFYVIEW method.
    if first_time = abap_true.
        wd_this->m_view = view.
      endif.
    Regards,
    Srini.

  • Get parent control size in pixels

    Hi experts
    How can I retrieve parent control size in pixels?
    Thanks an advice.
    Edited by: Artem Zyuzko on Nov 24, 2011 3:11 PM

    hi John
    I'm using BusinessGraphics control and there is no way to bind a width or height attribute to it - it's not bindable.
    But I need to reduce or extend control to browser window. I rely on do this through wdDoModifyView method.

  • Get Parent container to change child height on resize Event

    Ok,
    I've created a composite component called ResizableTextArea.
    The parent is an extended class of Canvas called ResizableCanvas.
    The child is an extended class of TextArea called myTextArea.
    In myTextArea, there's an update function that makes the
    textarea change it's height based on explicit height (how many
    lines it actually has). when you add text, the height expands for
    the new text. When you delete, the textarea's height shrinks to
    contain the text. Beautiful.
    Now, the parent, ResizeableCanvas, has a button that let's me
    drag the width. The child's width is set to 100% of parent so it
    resizes along with it. However, no matter what I try, when I resize
    the parent canvas, the child textarea will not update its height.
    I've tried everything I know and some, but nothing triggers
    the change. Please assist!

    Sure, just focus on the last class, ResizableTextArea. Canvas
    on the outside, Textarea on the inside.

  • Nifty tip:  How to get display container parent references to compile. (AS3)

    Hello,
    I appreciate the help I've received in this forum and wanted
    to give back a little bit (am not familiar enough with AS3 yet to
    answer questions).
    Today I encountered a tricky problem in referencing a parent
    container. The class structure was something like this:
    class wrapper extends Sprite {
    function wrapper() {
    var displayChild = new displayChild();
    addChild( displayChild );
    function parentFunction() {
    //Code here
    class displayChild {
    function childFunction() {
    parent.parentFunction();
    This code compiled and ran properly in standard mode. The
    problem was that this type of structure wouldn't compile in strict
    mode. It gave an error:
    1061: Call to a possibly undefined method parentFunction
    through a reference with static type
    flash.display:DisplayObjectContainer.
    The fix was to reference the parent like this:
    function childFunction() {
    var parentObj = parent;
    parentObj.parentFunction();
    However after putting this fix into three or four functions I
    decided to make parentObj a global. Believe it or not, the
    following wouldn't compile:
    class displayChild {
    var parentObj = parent;
    In other words, the compiler would only accept the fix if the
    parentObj reference was in a function.
    Why would this be? Any takers?
    It turns out that the parent object doesn't exist until the
    constructor has completed running. We encountered this in Flash MX
    when using embedded movie clips too. A movie clip or any display
    object (in AS3) doesn't exist until it is completely loaded. If it
    doesn't exist it doesn't have a parent. So the parent reference is
    invalid at compile time. It is only valid at runtime. When we call
    a function at runtime, the parent exists so we can assign it to
    parentObj and use it to call the parent.
    Luckily the compiler is forgiving enough to allow the
    statement:
    var parentObj = parent;
    even though parent is undefined. But of course the compiler
    has to allow this, otherwise it wouldn't allow us to assign any
    undefined values to a variable.
    Hope this is helpful to someone!
    Cheers,
    Mark

    Hi,
       Try this:
    RootUIElementContainer - GridLayout, colCount=1, width=500px.
    Goup1 - FlowLayout, colSpan=1, width=100%.
    Group2 - FlowLayout, colSpan=1, width=100%.
    Regards,
    Satyajit.
    Message was edited by: Satyajit Chakraborty

  • Datagrid Scrolling Problem.. Does not fit into Parent Container..

    Hi All,
           I have a module and module contains only one datagrid. I am adding this module to tab navigator dynamically in the next index. I am using Text as Item renderer in the datagrid and the row height will change depending upon the data diplyed on the Text. When the data populate in datagrid the datagrid going beyond the containers layout. i.e height is not fit into parent container. I am using Canvas as parent container .. Please find the below attached pictures and you will get to know what is my problem?
    Please help me to get out from this issue.. It is urgent..

    Thanks for quick reply
                   Here I am adding this module to canvas and the canvas is also dynamic . As you said "customize the measure() method in Text control and return the correct measuredHeight based on the explicitWidth."  what is the relation between Text control height and datagrid? Datagird should take it's parent container width and heights.  I am newbie to this Flex.. can you please explain it briefly. And if you have any Other way to do this please tell me .. it is very helpful to me.. Can you please post cusomized measure method if possible. please

  • IFrame(child container) still visible after closing the title window(parent container)

    Hi All ,
    I have created a sample project using a link button which when clicked opens up an TitleWindow which has an iframe and a text area in a hbox
    When you execute the application ,
              Click the link button
              The Popup window opens up showing the title window with the close button
              Click the close button of the title window
              The Title window is removed and the iframe and the text area are not visible
    Do this a couple of times
    You can notice that the iframe is still visible even when the title window is closed
    Can someone explain me how this issue can be resolved and also explain me why the iframe(child container) is still visible when the title window(parent container) is not visible. 
    Main Application file
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
        width="100%" height="100%" creationPolicy="all"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical" creationComplete="init()"
        xmlns:containers="containers.*">
       <mx:Script>
       <![CDATA[
           import mx.managers.PopUpManager;
           import containers.PopUpBrowser;
           public function doRequest():void
                    var requestPopup:PopUpBrowser = PopUpManager.createPopUp(this, PopUpBrowser) as PopUpBrowser;
                    PopUpManager.addPopUp(requestPopup,this);
                    requestPopup.x = 220;
                    requestPopup.y = 50;
       ]]>
       </mx:Script>
       <mx:Text fontSize="14" fontWeight="bold" text="Click the link button below to open the Title Window" />
       <mx:Spacer height="100"/>
       <mx:LinkButton label="Click me" fontSize="16" fontWeight="bold" click="doRequest()"/>
    </mx:Application>
    PopUpBrowser.mxml Component
    <?xml version="1.0" encoding="utf-8"?>
    <mx:TitleWindow
        xmlns:mx="http://www.adobe.com/2006/mxml"
        close="removeMe()"
        showCloseButton="true"
        styleName="myTitleWindowStyle"
        width="850" height="500"
        title="Klout User Profile"
        paddingTop="1" paddingBottom="1"
        paddingLeft="1" paddingRight="1"
        xmlns:generic="com.serendio.voom.components.generic.*"
        xmlns:flexiframe="http://code.google.com/p/flex-iframe/"
        horizontalScrollPolicy="off"
        verticalScrollPolicy="off" >
        <mx:Script>
            <![CDATA[
                import mx.managers.PopUpManager;
                public function removeMe():void
                    PopUpManager.removePopUp(this);
            ]]>
        </mx:Script>
        <mx:HBox width="100%" height="100%">
        <flexiframe:IFrame source="http://www.google.com" id="iFrame" width="50%" height="100%"/>
        <mx:TextArea text="Open and close the title window few times and watch the iframe remain visible even when the title window is closed"
             fontSize="14" width="50%" height="80%"/>
        </mx:HBox>
    </mx:TitleWindow>
    Thanks,
    Ajantha

    Hey,
    This is working fine for me with the current 4.5 Flex, Firefox 3.6.12, IE8. On what browser you are getting this error.
    Thanks,
    Jayagopal.

  • How can i centre two side by side divs vertically so they both are in the centre of there parent /containing div?

    How can i centre two side by side divs vertically so they both are in the centre of there parent /containing div? One of the divs is larger than the other so i would want the smaller one to centre inside a parent div like so:
    Grey= parent/container (Width of both orange and red div)
    Orange= Div 1
    Red= Smaller div- centralised (hopefully)

    If you wanted to go completely "Not for IE8 or lower" and use some of the often overlooked viewport units, it could be very responsive to browser resizing...
    <!doctype html>
    <html lang="en-us">
    <head>
    <meta charset="utf-8">
    <title> VW, it's not just a car for Mac users...</title>
    <style>
         -moz-box-sizing:border-box;
         -webkit-box-sizing:border-box;
         box-sizing:border-box;
    #gray {
        background-color:gray;
        width:80vw;
        margin:0 auto;
        height:40vw;
        font-size:2vw;
    #red {
        width:50%;
        height:50%;
        background-color:red;
        margin-top:12.5%;
        float:left;
    #orange {
        background-color:orange;
        width:50%;
        height:100%;
        float:left;
    </style>
    <!--[if lt IE 9]>
    <link href="IE-only.css" rel="stylesheet" type="text/css">
    <![endif]-->
    </head>
    <body>
    <div id="gray">
        <div id="orange"></div>
        <div id="red"></div>
    </div>
    </body>
    </html>

  • Get parent component

    Hi all,
    Is there any method to get parent component (container) of a jcomponent?

    Did you think to look at the API? Some method names are obvious. Other are not. The least you can do is try. All you had to do was find any method with the word "parent" in it.

  • How to force a responsive Edge animation to re-evaluate its container size?

    I have an Edge animation stage embedded in a relatively complex page, inside a container div whose width is set by media queries and which may or may not be faded out by $.fadeOut. I've figured out how to trigger playback, but the stage doesn't seem to be updating its estimate of the container's width regularly. Specifically, the stage will scale itself to its min-width (disappearing if there is no min-width) and get stuck there in a specific case when the container's container has been hidden then shown again. And even when the stage is visible and on screen, if I make the browser thinner then wider, it seems to scale itself down but never back up. These weird problems would both be explained if the stage wasn't consistently re-evaluating how large its container was.
    In that case - is there a way to force the stage to re-evaluate its container size using Javascript? Wasn't able to find anything in the documentation about this.
    Thanks!

    Hi, Chi-
    Funny you should mention this... I actually just posted a blog post about something very similar.
    https://blogs.adobe.com/edge/2013/09/05/floral-matchmaker-tutorial-3-hiding-and-showing-th e-game-board/
    You can put your responsive div in an iframe set to a certain % of your main page.
    -Elaine

  • Float clearing for parent container - DW doesn't display

    When I use one of the methods of float clearing for a parent container that has other floated elements inside of it, it seems to work fine in FF and IE. But it never shows up properly in DW design view. Instead, it just continues to show the parent container as collapsed.
    Is there some setting in DW that I can change to make it display properly? It's difficult to really know what's going on when it displays like this.
    Thanks...
    -Jesse

    JesseLY wrote:
    Thanks, Osgood. Here's a link to a test page.
    http://www.jesseyoung.com/tests/float_test/
    It displays fine in FF and IE, but shows the outer container as collapsed in DW design view.
    -Jesse
    Hi Jesse
    Change overflow: auto; to overflow: hidden; on the 'wrapper' css as below. This method will only work in DW CS4 design view.
    If you have a previous version of DW then you'll need to use the <br style="clear: both;"> method in the code if you want to see the correct rendering in Design view (see below)
    #wrapper {
    border: 5px solid purple;
    padding: 10px;
    overflow: hidden;
    width: 700px;
    background-color: white;
    Insert the <br> after the last floated element (as below)
    </div><!-- end floatLeft -->
    <br style="clear: both;" />
    </div><!--end wrapper -->
    Incidentally you appear to have an 'unpaired' </div> tag at the end of the code .

  • Getting the ACTUAL size of a JTable

    Hi all, I've been trying to get the actual size of a JTable for awhile now. I have tried just about every getSize or whatever other size method you can think of and nothing is working out for me. A lot of the times I'll get a value of 0 and other times I'll get a non-zero value. The variance is coming from which getSize method I use and where I'm using it. Whatever the value is though, they do not match up with the actual size that I'm seeing when everything is displayed.
    My JTable is within a JScrollPane, which is within a JSplitPane. The JTable takes up the complete size of the JScrollPane and the JScrollPane takes up the complete size of JSplitPane (the top component at least). I have tried getting the sizes from each of these components that are used to contain the JTable, but each one of the values I get are incorrect too.
    Anyone have any ideas to help me out?
    Thanks, Bryan

    Thanks for your help camickr.
    I ended up writing a component listener for the frame since componentShown only listens for calls to the setVisible method. Also, I can now resize the table columns whenever the user resizes the frame.
        /*Add component listener to frame.  When frame is shown or
          resized, then set student table column widths*/
        this.addComponentListener(new ComponentListener() {
          public void componentShown(ComponentEvent e) {
            setStudentTableColumnWidths();
          public void componentResized(ComponentEvent e) {
            setStudentTableColumnWidths();
          public void componentMoved(ComponentEvent e) {}
          public void componentHidden(ComponentEvent e) {}
       * Sets the student table column widths.  The username column should take up
       * ~1/3 of the table and the student name column should take up ~2/3 of the
       * table.
      private void setStudentTableColumnWidths()
        TableColumnModel tableColumnModel = studentsTable.getColumnModel();
        Dimension scrollPaneViewportSize = studentsTableScrollPane.getViewport().getSize();
        int usernameColWidth = scrollPaneViewportSize.width/3;
        int studentNameColWidth = scrollPaneViewportSize.width - usernameColWidth;
        tableColumnModel.getColumn(0).setPreferredWidth(usernameColWidth);
        tableColumnModel.getColumn(1).setPreferredWidth(studentNameColWidth);
      }

  • How to get the byte[] size dynamically from the StreamMessage object

    Hi all,
    Using JMS, I am receiving the FDF file as StreamMessage from the queue and attaching it to the PDF file which is present in the local system.
    For that, I have written the code as follows:
    {color:#0000ff} Message msg = jmsTemplate.receive();
    if(msg !=null && msg instanceof StreamMessage)
    StreamMessage message = (StreamMessage) msg;{color}
    {color:#ff6600}//hardcoded the byte array size value
    {color}{color:#0000ff} byte[] bytes = new byte[{color:#ff0000}856{color}];
    System.out.println("read msg="+message.readBytes(bytes));{color}
    {color:#0000ff}PdfReader pdfreader = new PdfReader("D:\\Managing_Workflows_No_Comment.pdf");
    PdfStamper stamp = new PdfStamper(pdfreader, new FileOutputStream("D:\\12345.pdf"));
    FdfReader fdfreader = new FdfReader(bytes);
    stamp.addComments(fdfreader);
    {color} {color:#0000ff} stamp.close();
    {color}{color:#000000}The above code is working fine except with the hardcoded of {color:#ff0000}byte array{color}{color:#ff0000} size value{color} which is given in {color:#ff0000}RED{color} in color.
    Can anybody know, {color:#000000}*how to get the byte[] size dynamically from the StreamMessage*{color} object ?
    Any help would be highly beneficial for me !!!!
    Thanks and Regards,
    Ganesh Kumar{color}

    When you create your stream message you could add an property to your message, something like streamSize that would contain the number of bytes in your stream message. Then you could get this property from the message before declaring your array.
    Tom

  • How do I get correct text size in MM

    Hi all
    (Illustrator CS4)
    One thing has been puzzling me while using Illustrator. If I am given a job and it says the text needs to be 2mm high how do I do this? If I type 2mm into the character tool the size of the text when turned into paths is actually 1.444 mm?! Is there any way of getting text in exact mm without guess work!
    Regards
    Matthew

    Hi everyone,
    this topic has already been answered, but I didn't find the method I've come to use mentioned.
    There are two ways I use to do this, both with the same results in sizing.
    #1:
    If I don't need editable type at all, I just create outlines out of everything and change the height.
    This works if you don't need the font-size and want every letter to fit into a rectangle with the same height.
    #2:
    By adding a Live Effect in the Appearance-panel, you can achieve the same results as you do with create outlines, but with the added bonus of getting the font-size and you can even choose just one letter to set the height by.
    I choose Path > Outline Object in the Appearance-panel, followed by typing in whatever mm I want in the transform panel, not the font size. Then I clear the appearance.
    By turning on the bounding box you can also see what's happening. When you create outlines from type, the bounding box
    will "hug" the letters tightly and not use the usual upper/lower-case bounding box.
    If the customer knows what letter he wants to be exactly measured, I use this method first and save the font-size that comes up and write with it.
    Hope this helps someone out there, it works for me.
    -Asbjørn

  • Problem with Jtree to xml tranform..how to set/get parent of a node?

    Hi,
    I am trying to develop xml import/export module.In import wizard, I am parsing the xml file and the display it in Jtree view using xml tree model which implements TreeModel and xml tree node.I am using jaxp api..
    It is workin fine.
    I got stuck with removal of selected node and save it as a new xml.
    I am not able to get parent node of selected node in remove process,itz throwing null.I think i missed to define parent when i load treemodel.Plz help me out..give some ideas to do it..
    thanks
    -bala
    Edited by: r_bala on May 9, 2008 4:44 AM

    there's no way anyone can help you without seeing your code.

Maybe you are looking for

  • Copy Open sales oder from one DB to Other DB

    Hi Expets, Can any one help me how to copy Open Sale Order from one data to another Database which exact replica(Both are Same configration) Kathi.

  • GR55 Report Takes long time.

    Hi experts, System Details: ECC 6.0; Windows 2008 R2; MS SQL 2005 Database. Archiving is done and now when our functional team is running the GR55 to access data, it is taking a hell lot of time to bring-out the data. They have approached the Basis t

  • What is the best practice to protect coldfusion administrator login page

    Hi all, Can someone suggest what is the best practice to protect the administrator login? At the moment, there is only the normal administrator page password to protect. It seems like not very secure especially when the application is on the internet

  • Apple Developer Notification Regarding Xcode5

    Hi, I just received a notification from Apple, that "Starting February 1, new apps and app updates submitted to the App Store must be built with Xcode 5 and iOS 7 SDK."  Does this have any implications for those of us developing for iOS using AIR? Th

  • Shared memory between LV and a DLL

    Hello I am building a DLL in Visual .NET. It is called by LV in a .vi The DLL is counting some stuffs over a network, and I d'like to see the counter status in the vi, dynamically. This means that when the variable is changed is the DLL, the LabView