我正在使用flex TitleWindow,我已将其宽度和高度设置为100%。此TitleWindow中放置了一个数据网格。但是,无论我做了什么来改变窗口大小,它都没有得到反映。更改只是反映在Eclipse设计窗口中,而不是在实际应用程序中。任何人都可以提出建议吗?
<?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>
答案 0 :(得分:1)
为Application容器和TitleWindow的所有父项设置width="100%" height="100%"
。
答案 1 :(得分:0)
谢谢大家的帮助。
@Ilya Z:我只是在实施您的解决方案,但我不想更改父级的大小。我想改变当前元素相对于父元素'大小的大小。
这是我做的:
在我显示此弹出窗口的mxml文件(GanttChartPanel)中,我添加了以下行:
//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);