You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Cristina Constantinescu <cr...@crispico.com> on 2013/06/04 12:37:59 UTC

Automatically resize a container when adding a component

Hi,

Why doesn't a parent container automatically resize when adding an element bigger than its width/heigth?
Isn't this considered the default behavior?

Here is my sample:

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" >	
	<s:layout>
		<s:VerticalLayout gap="10" />
	</s:layout>
	
	<fx:Script>
		<![CDATA[
			import spark.components.BorderContainer;
			import spark.components.Button;
				
			protected function clickHandler(event:MouseEvent):void {
				var child:spark.components.Button = new spark.components.Button();
				child.label = "Loooooooooooooog Label";
				
				container.addElement(child);
			}
		]]>
	</fx:Script>
					
	<s:Button label="Add Button" click="clickHandler(event)" />	
	<s:VGroup id="container" width="50" height="50" />		
	
</s:Application>


Re: Automatically resize a container when adding a component

Posted by Cristina Constantinescu <cr...@crispico.com>.
Yes, I will use this solution.
Thanks a lot.

On 04.06.2013 14:26, Tihomir Leka wrote:
> You can use minWidth and minHeight and the container will resize when you
> put bigger element inside, but will never be smaller then 50x50.
>
> Cheers
>
>
> On Tue, Jun 4, 2013 at 12:44 PM, Mark Line <ma...@gmail.com> wrote:
>
>> You are explicitly setting its width and height in mxml. It will never
>> change size
>>
>> Hope that helps
>>
>> Mark
>>
>> -----Original Message-----
>> From: Cristina Constantinescu [mailto:cristina.constantinescu@crispico.com
>> ]
>> Sent: 04 June 2013 11:38
>> To: users@flex.apache.org
>> Subject: Automatically resize a container when adding a component
>>
>> Hi,
>>
>> Why doesn't a parent container automatically resize when adding an element
>> bigger than its width/heigth?
>> Isn't this considered the default behavior?
>>
>> Here is my sample:
>>
>> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>> xmlns:s="library://ns.adobe.com/flex/spark"
>> xmlns:mx="library://ns.adobe.com/flex/mx" >
>>          <s:layout>
>>                  <s:VerticalLayout gap="10" />
>>          </s:layout>
>>
>>          <fx:Script>
>>                  <![CDATA[
>>                          import spark.components.BorderContainer;
>>                          import spark.components.Button;
>>
>>                          protected function
>> clickHandler(event:MouseEvent):void {
>>                                  var child:spark.components.Button = new
>> spark.components.Button();
>>                                  child.label = "Loooooooooooooog Label";
>>
>>                                  container.addElement(child);
>>                          }
>>                  ]]>
>>          </fx:Script>
>>
>>          <s:Button label="Add Button" click="clickHandler(event)" />
>>          <s:VGroup id="container" width="50" height="50" />
>>
>> </s:Application>
>>
>>
>


Re: Automatically resize a container when adding a component

Posted by Tihomir Leka <ti...@gmail.com>.
You can use minWidth and minHeight and the container will resize when you
put bigger element inside, but will never be smaller then 50x50.

Cheers


On Tue, Jun 4, 2013 at 12:44 PM, Mark Line <ma...@gmail.com> wrote:

> You are explicitly setting its width and height in mxml. It will never
> change size
>
> Hope that helps
>
> Mark
>
> -----Original Message-----
> From: Cristina Constantinescu [mailto:cristina.constantinescu@crispico.com
> ]
> Sent: 04 June 2013 11:38
> To: users@flex.apache.org
> Subject: Automatically resize a container when adding a component
>
> Hi,
>
> Why doesn't a parent container automatically resize when adding an element
> bigger than its width/heigth?
> Isn't this considered the default behavior?
>
> Here is my sample:
>
> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
> xmlns:s="library://ns.adobe.com/flex/spark"
> xmlns:mx="library://ns.adobe.com/flex/mx" >
>         <s:layout>
>                 <s:VerticalLayout gap="10" />
>         </s:layout>
>
>         <fx:Script>
>                 <![CDATA[
>                         import spark.components.BorderContainer;
>                         import spark.components.Button;
>
>                         protected function
> clickHandler(event:MouseEvent):void {
>                                 var child:spark.components.Button = new
> spark.components.Button();
>                                 child.label = "Loooooooooooooog Label";
>
>                                 container.addElement(child);
>                         }
>                 ]]>
>         </fx:Script>
>
>         <s:Button label="Add Button" click="clickHandler(event)" />
>         <s:VGroup id="container" width="50" height="50" />
>
> </s:Application>
>
>


-- 
Tihomir Leka

RE: Automatically resize a container when adding a component

Posted by Mark Line <ma...@gmail.com>.
You are explicitly setting its width and height in mxml. It will never
change size

Hope that helps

Mark

-----Original Message-----
From: Cristina Constantinescu [mailto:cristina.constantinescu@crispico.com] 
Sent: 04 June 2013 11:38
To: users@flex.apache.org
Subject: Automatically resize a container when adding a component

Hi,

Why doesn't a parent container automatically resize when adding an element
bigger than its width/heigth?
Isn't this considered the default behavior?

Here is my sample:

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" >	
	<s:layout>
		<s:VerticalLayout gap="10" />
	</s:layout>
	
	<fx:Script>
		<![CDATA[
			import spark.components.BorderContainer;
			import spark.components.Button;
				
			protected function
clickHandler(event:MouseEvent):void {
				var child:spark.components.Button = new
spark.components.Button();
				child.label = "Loooooooooooooog Label";
				
				container.addElement(child);
			}
		]]>
	</fx:Script>
					
	<s:Button label="Add Button" click="clickHandler(event)" />	
	<s:VGroup id="container" width="50" height="50" />		
	
</s:Application>