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>
  • 相关阅读:
    Javascript正则表达式详解转载
    转载Sqlserver2005 存储过程分页
    转载手把手教你用C#打包应用程序
    学习内容
    用C#实现将HTML文件转换为CHM文件(转)
    C# Windows服务添加安装程序
    sql 2008评估期已过有关如何升级,企业试用版到期,升级为企业版+sql2008破解
    iis不能启动是什么原因?错误提示:“提示服务器没有及时相应启动或控制请求”
    .NET 获取数据库中所有表名的方法
    如何获取Dynamics当前登录的用户的GUID,进而获取用户的信息
  • 原文地址:https://www.cnblogs.com/frost-yen/p/5195384.html
Copyright © 2011-2022 走看看