Adjust the width (and height) of the dropdown lists based on the size of their contents
authorAndy Allan <gravitystorm@gmail.com>
Fri, 3 Dec 2010 11:08:04 +0000 (11:08 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Fri, 3 Dec 2010 11:08:04 +0000 (11:08 +0000)
net/systemeD/potlatch2/BackgroundSelector.mxml
net/systemeD/potlatch2/StyleSelector.mxml

index fc65178..964bf98 100644 (file)
@@ -4,10 +4,11 @@
        paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10"
        horizontalAlign="left" backgroundColor="white" borderStyle="inset">
        
-       <mx:List width="100%" height="100%" id="background" verticalScrollPolicy="on" 
+       <mx:List width="100%" height="100%" id="background"
                        labelField="name"
-                       change="Application.application.bgButton.close(); Imagery.instance().setBackground(background.selectedItem);"                   
-               dataProvider="{Imagery.instance().getAvailableImagery()}" />
+                       change="Application.application.bgButton.close(); Imagery.instance().setBackground(background.selectedItem);"
+               dataProvider="{Imagery.instance().getAvailableImagery()}"
+               updateComplete="{background.width=background.measureWidthOfItems()+2;background.height=background.measureHeightOfItems()+2}"/>
        <mx:HBox>
        <mx:CheckBox width="100%" label="Dim" selected="{Application.application.theMap.getDimming()}" id="dim"
            change="setDimming(dim.selected)" />
index 9cc34e4..71bcfed 100644 (file)
@@ -7,7 +7,8 @@
        <mx:List width="100%" height="100%" id="mapStyle" 
                labelField="name"
                change="Application.application.styleButton.close(); Stylesheets.instance().setStylesheet(mapStyle.selectedItem.name, mapStyle.selectedItem.url);"
-               dataProvider="{Stylesheets.instance().getCollection()}" />
+               dataProvider="{Stylesheets.instance().getCollection()}"
+               updateComplete="{mapStyle.width=mapStyle.measureWidthOfItems()+2;mapStyle.height=mapStyle.measureHeightOfItems()+2}" />
 
        <mx:Button label="Edit..." click="new BackgroundDialog().init('Map style',mapStyle,Stylesheets.instance());" />