为什么我的弹出面板的子项出现在面板之外

发布于 2024-11-29 00:44:09 字数 1901 浏览 1 评论 0原文

我正在使用 flex 4 弹出管理器弹出一个面板,但面板的子项没有留在面板内。但是当我关闭弹出窗口时,孩子们将被删除。

像这样:(抱歉我不能发布图片)

           ----------
           l________l
           l        l
  ..... please enterl
           l--------1

有人知道为什么吗?这是我的代码:

var forgotPopup:Panel = PopUpManager.createPopUp(this, forgottenForm, true) as Panel;
        PopUpManager.centerPopUp(forgotPopup);

这就是我弹出的内容:

<?xml version="1.0" encoding="utf-8"?>
<s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" width="218" height="168" skinClass="PanelSkin" title="Reset Details">


    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

    <fx:Script>
        <![CDATA[

            import mx.controls.Alert;
            import mx.events.FlexEvent;
            import mx.managers.PopUpManager;

            // Handle the close button and Cancel button.
            private function handleCloseEvent():void {
                PopUpManager.removePopUp(this);
            }

        ]]>
    </fx:Script>

    <mx:Form horizontalCenter="0" verticalCenter="0">
        <mx:FormHeading label="Please enter your e-mail address and your login details will be e-mailed to you"/>
        <mx:FormItem label="E-mail">
            <s:TextInput id="userInput" x="78" y="49"/>
        </mx:FormItem>
        <mx:FormItem direction="horizontal">
            <s:Button id="okButton" label="Submit" skinClass="ButtonSkin" />
            <s:Button id="cancelButton" label="Cancel" skinClass="ButtonSkin"/>
        </mx:FormItem>  
    </mx:Form>

</s:Panel>

对此的任何帮助都会很棒,谢谢。

I am using the flex 4 popup manager to popup a panel, but the children of the panel are not staying inside the panel. But when i close the popup the children are being removed.

Like this: (sorry i can't post pics)

           ----------
           l________l
           l        l
  ..... please enterl
           l--------1

Anybody know why? Here's my code:

var forgotPopup:Panel = PopUpManager.createPopUp(this, forgottenForm, true) as Panel;
        PopUpManager.centerPopUp(forgotPopup);

And here's what i'm popping up:

<?xml version="1.0" encoding="utf-8"?>
<s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" width="218" height="168" skinClass="PanelSkin" title="Reset Details">


    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

    <fx:Script>
        <![CDATA[

            import mx.controls.Alert;
            import mx.events.FlexEvent;
            import mx.managers.PopUpManager;

            // Handle the close button and Cancel button.
            private function handleCloseEvent():void {
                PopUpManager.removePopUp(this);
            }

        ]]>
    </fx:Script>

    <mx:Form horizontalCenter="0" verticalCenter="0">
        <mx:FormHeading label="Please enter your e-mail address and your login details will be e-mailed to you"/>
        <mx:FormItem label="E-mail">
            <s:TextInput id="userInput" x="78" y="49"/>
        </mx:FormItem>
        <mx:FormItem direction="horizontal">
            <s:Button id="okButton" label="Submit" skinClass="ButtonSkin" />
            <s:Button id="cancelButton" label="Cancel" skinClass="ButtonSkin"/>
        </mx:FormItem>  
    </mx:Form>

</s:Panel>

Any help on this would be brilliant, thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

匿名。 2024-12-06 00:44:09

尝试使用以下内容:

<?xml version="1.0" encoding="utf-8"?>
<s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" width="218" height="168" skinClass="PanelSkin" title="Reset Details">


    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

    <fx:Script>
        <![CDATA[

            import mx.controls.Alert;
            import mx.events.FlexEvent;
            import mx.managers.PopUpManager;

            // Handle the close button and Cancel button.
            private function handleCloseEvent():void {
                PopUpManager.removePopUp(this);
            }

        ]]>
    </fx:Script>

    <mx:Form left="10" right="10" top="10" bottom="10">
        <mx:FormHeading label="Please enter your e-mail address and your login details will be e-mailed to you"/>
        <mx:FormItem label="E-mail">
            <s:TextInput id="userInput" x="78" y="49"/>
        </mx:FormItem>
        <mx:FormItem direction="horizontal">
            <s:Button id="okButton" label="Submit" skinClass="ButtonSkin" />
            <s:Button id="cancelButton" label="Cancel" skinClass="ButtonSkin"/>
        </mx:FormItem>  
    </mx:Form>

</s:Panel>

如果您需要将标题文字换行,则应拒绝标准 FormHeading 并将其替换为 Label

<?xml version="1.0" encoding="utf-8"?>
<s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" width="218" height="168" skinClass="PanelSkin" title="Reset Details">


    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

    <fx:Script>
        <![CDATA[

            import mx.controls.Alert;
            import mx.events.FlexEvent;
            import mx.managers.PopUpManager;

            // Handle the close button and Cancel button.
            private function handleCloseEvent():void {
                PopUpManager.removePopUp(this);
            }

        ]]>
    </fx:Script>

    <mx:Form left="10" right="10" top="10" bottom="10">
        <s:Label width="100%" text="Please enter your e-mail address and your login details will be e-mailed to you" fontWeight="bold" />
        <mx:FormItem label="E-mail">
            <s:TextInput id="userInput" x="78" y="49"/>
        </mx:FormItem>
        <mx:FormItem direction="horizontal">
            <s:Button id="okButton" label="Submit" skinClass="ButtonSkin" />
            <s:Button id="cancelButton" label="Cancel" skinClass="ButtonSkin"/>
        </mx:FormItem>  
    </mx:Form>

</s:Panel>

但最好的方法是切换到 Spark Form 其中自 Flex 起可用4.5.

Try to use the following:

<?xml version="1.0" encoding="utf-8"?>
<s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" width="218" height="168" skinClass="PanelSkin" title="Reset Details">


    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

    <fx:Script>
        <![CDATA[

            import mx.controls.Alert;
            import mx.events.FlexEvent;
            import mx.managers.PopUpManager;

            // Handle the close button and Cancel button.
            private function handleCloseEvent():void {
                PopUpManager.removePopUp(this);
            }

        ]]>
    </fx:Script>

    <mx:Form left="10" right="10" top="10" bottom="10">
        <mx:FormHeading label="Please enter your e-mail address and your login details will be e-mailed to you"/>
        <mx:FormItem label="E-mail">
            <s:TextInput id="userInput" x="78" y="49"/>
        </mx:FormItem>
        <mx:FormItem direction="horizontal">
            <s:Button id="okButton" label="Submit" skinClass="ButtonSkin" />
            <s:Button id="cancelButton" label="Cancel" skinClass="ButtonSkin"/>
        </mx:FormItem>  
    </mx:Form>

</s:Panel>

If you need to have header word wrapped you should reject standard FormHeading and replace it with Label:

<?xml version="1.0" encoding="utf-8"?>
<s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" width="218" height="168" skinClass="PanelSkin" title="Reset Details">


    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

    <fx:Script>
        <![CDATA[

            import mx.controls.Alert;
            import mx.events.FlexEvent;
            import mx.managers.PopUpManager;

            // Handle the close button and Cancel button.
            private function handleCloseEvent():void {
                PopUpManager.removePopUp(this);
            }

        ]]>
    </fx:Script>

    <mx:Form left="10" right="10" top="10" bottom="10">
        <s:Label width="100%" text="Please enter your e-mail address and your login details will be e-mailed to you" fontWeight="bold" />
        <mx:FormItem label="E-mail">
            <s:TextInput id="userInput" x="78" y="49"/>
        </mx:FormItem>
        <mx:FormItem direction="horizontal">
            <s:Button id="okButton" label="Submit" skinClass="ButtonSkin" />
            <s:Button id="cancelButton" label="Cancel" skinClass="ButtonSkin"/>
        </mx:FormItem>  
    </mx:Form>

</s:Panel>

But the best way is to switch to Spark Form which is available since Flex 4.5.

孤千羽 2024-12-06 00:44:09

请避开X和Y位置
这也可能导致对象位置。

Please Avoid X and Y position
this might also cause the Objects Positions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文