1
votes

I am using flex TitleWindow and I have set its width and height as 100% for both. There is one datagrid placed in this TitleWindow. However, whatever I did to change the window size, it is not getting reflected. Changes are just getting reflected inside the Eclipse design window but not in actual application. Can anyone please suggest something?

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
            width="100%"
            height="100%"
            verticalScrollPolicy="off"
            title="GanttChart"
            xmlns:project="mpt.project.*"
            showCloseButton="true"
            close="closePopup()"
            >
<mx:Script>
    <![CDATA[
        import mpt.vo.project.GanttChart;
        import mx.collections.ArrayCollection;
        import mx.managers.PopUpManager;
        [Bindable]
        private var styledEditor:IFactory=new ClassFactory(StyledItemEditor);

        [Bindable]
        private var dataForGanttGrid:ArrayCollection;//=new ArrayCollection([{title: "Task 1", start: 0, duration: 3, percentComplete: .7}, {title: "Task 2", start: 1, duration: 3, percentComplete: .5}, {title: "Task 3", start: 2, duration: 3, percentComplete: .3}, {title: "Task 4", start: 5, duration: 5, percentComplete: 0}]);

        public function init():void
        {
            this.dataForGanttGrid=new ArrayCollection();
        }
        public function setDataForGanttGrid(title:String,start:int,duration:int,setPosition:int):void
        {
            this.dataForGanttGrid.addItemAt({title: title, start: start, duration: duration, percentComplete: .7},setPosition);
        }
        private function closePopup():void
        {
            PopUpManager.removePopUp(this);
        }
    ]]>
</mx:Script>

<mx:VBox width="100%"
         height="100%">

    <project:GanttDataGrid width="100%"
                           height="100%"
                           max="10"
                           ganttItemEditor="{styledEditor}"
                           taskHeaderWidth="170"
                           dataProvider="{dataForGanttGrid}"/>

</mx:VBox>

</mx:TitleWindow>
2
TitleWindows are usually intended to be used as pop ups; and in my experience often created in ActionScript. That said; how are you setting the width and height to 100%? Using the percentHeight and percentWidth values? How are you changing the window size? When you say "not getting reflected" do you mean that the height and width of the title window are not changing or the DataGrid size is not changing? Or something else? - JeffryHouser
Size of TitleWindow and Datagrid, both not getting changed. - genonymous

2 Answers

1
votes

Set width="100%" height="100%" for Application container and all parents of TitleWindow.

0
votes

Thanks all for help.

@Ilya Z: I was implementing your solution only but I didn't want to change the parent's size. I wanted to change size of current element relative to parent element' size.

Here is what I did:

In the mxml file (GanttChartPanel) where I was showing this popup, I added following lines:

//previous lines
PopUpManager.addPopUp(gantt,this,true);
PopUpManager.centerPopUp(gantt);

//New lines    
gantt.height=.8*this.height;
gantt.width= .8*this.width;
PopUpManager.addPopUp(gantt,this,true);
PopUpManager.centerPopUp(gantt);