zoukankan      html  css  js  c++  java
  • [Flex] PopUpButton系列 —— 弹出菜单的行高设置

    <?xml version="1.0" encoding="utf-8"?>
    <!--Flex中如何通过variableRowHeight样式减少PopUpButton与弹出菜单间间距的例子 PopUpButtonRowHeight.mxml -->
    <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" minWidth="955" minHeight="600"  >
        <fx:Script>
            <![CDATA[
                import mx.controls.Menu;
                import mx.events.DropdownEvent;
                import mx.events.FlexEvent;
                import mx.utils.ObjectUtil;
                
                protected function popUpButton1_initializeHandler(event:FlexEvent):void
                {
                    var menu:Menu = new Menu();
                    menu.showRoot = false;
                    menu.labelField = "@label";
                    menu.dataProvider = ObjectUtil.copy(data);
                    popUpButton1.popUp = menu;
    
                }
                protected function popUpButton2_initializeHandler(event:FlexEvent):void
                {
                    var menu:Menu = new Menu();
                    menu.showRoot = false;
                    menu.labelField = "@label";
                    menu.dataProvider = ObjectUtil.copy(data);
                    menu.variableRowHeight = true;
                    popUpButton2.popUp = menu;
    
                }
                protected function popUpButton1_openHandler(event:DropdownEvent):void
                {
                    popUpButton1.open();
                    popUpButton2.open();
    
                }
                
                protected function popUpButton1_creationCompleteHandler(event:FlexEvent):void
                {
                    var pUB:PopUpButton = event.currentTarget as PopUpButton;
                    // resize and open
                    pUB.popUp.width = pUB.width;
                    pUB.open();
    
                }
                
            ]]>
        </fx:Script>
        <fx:Declarations>
            <!-- 将非可视元素(例如服务、值对象)放在此处 -->
            <fx:XML id="data" source="data.xml"/>
        </fx:Declarations>
        <fx:Style>
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/mx";
            mx|PopUpButton {
                openDuration: 0;
                closeDuration: 0;
                fontWeight: normal;
                textAlign: left;
            }
    
        </fx:Style>
        <s:HGroup>
            <mx:PopUpButton id="popUpButton1" label="variableRowHeight = false" openAlways="true" width="250" initialize="popUpButton1_initializeHandler(event)" creationComplete="popUpButton1_creationCompleteHandler(event)" open="popUpButton1_openHandler(event)"/>
            <mx:PopUpButton id="popUpButton2" label="variableRowHeight = true" openAlways="true" width="250" initialize="popUpButton2_initializeHandler(event)" creationComplete="popUpButton1_creationCompleteHandler(event)" open="popUpButton1_openHandler(event)"/>
        </s:HGroup>
    </s:Application>
  • 相关阅读:
    WWF中关于External Data Exchange Service的错误
    通用异常处理框架(转载)
    追MM和23种设计模式(转载)
    编译:XAML与程序代码结合(转载)
    异步编程*(转载)
    出糗~又是工作流!
    由WorkflowOwnershipException 异常,联想出的部署犯案
    Nullable类型,C#溢出检查,typeof运算符和运算符的重载 分类: C# 20121028 19:50 648人阅读 评论(0) 收藏
    我的程序员之路(九)参加郑州微软MVP宣讲会后的一些思考
    C#结构的学习
  • 原文地址:https://www.cnblogs.com/frost-yen/p/5195384.html
Copyright © 2011-2022 走看看