You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Maurice Amsellem <ma...@systar.com> on 2013/07/31 18:52:28 UTC

Problem with PopupManager

Hi,
I am using PopupManager to display and center a popup around a button.
However, when the button is close to the border of the application, the popup  is clipped .
The various comments in PopupManagerImpl.as centerPopUp() suggest  that off-screen clipping is somehow handled , but it does not seem to have any effect in that case.

Note: PopupAnchor does the clipping correctly, but I can't use it, as I am using Parsley / Cairngorm PopupWrapper.

Any idea ?

Sample code below:
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark">
    <s:Button id="btPopup2" top="80" right="50" label="Pop2" click="btPopup2_clickHandler(event)"/>
    <fx:Script><![CDATA[
        import mx.managers.PopUpManager;
        private function btPopup2_clickHandler(event:MouseEvent):void {
            var panel: Panel = new Panel();
            with(panel){
                id="panel";
                title="Panel2";
                width=200;
                height =150;
            }
            PopUpManager.addPopUp(panel,btPopup2);
            PopUpManager.centerPopUp(panel);
        }
        ]]></fx:Script>
</s:Application>


Maurice Amsellem
SYSTAR R&D - BusinessBridgeFX
[Description : Telephone:] +33(0)1 49 11 45 62  /  [Description : Mobile Phone:] +33(0)6 07 48 95 43


RE: Problem with PopupManager

Posted by Maurice Amsellem <ma...@systar.com>.
Thanks Alex for the code snippet. 

Actually, the example given below was simplied for the sake of readability.

In real, I need a generic solution because there are many popups, all driven by Parsley,  and I don't know where the popups will be lying. 
I would like also to use the new experimental Callout of SDK 4.10, managed by Parsley.

I will work on combining PopupAnchor, Callout and Parsley's CairngormPopupSupport so that they can work  together.

Thanks again.

Maurice

-----Message d'origine-----
De : Alex Harui [mailto:aharui@adobe.com] 
Envoyé : jeudi 1 août 2013 00:16
À : users@flex.apache.org
Objet : Re: Problem with PopupManager

I think all I would add is popup.x = Math.min(popup.x, systemManager.screen.right - popup.width);

On 7/31/13 12:22 PM, "Maurice Amsellem" <ma...@systar.com>
wrote:

>Thanks,  I will raise a feature request for that.
>
>In the meantime, I intend to adapt some of the logic from PopupAnchor 
>(functions calculatePopUpPosition():Point and determinePosition) into 
>PopupWrapper subclass.
>
>Do you think it's a good idea ?
>
>Maurice
>
>-----Message d'origine-----
>De : Alex Harui [mailto:aharui@adobe.com] Envoyé : mercredi 31 juillet 
>2013 21:13 À : users@flex.apache.org Objet : Re: Problem with 
>PopupManager
>
>There is to right side bounds checking in PopUpManager.  Probably a 
>good feature to request.
>
>-Alex
>
>From: Maurice Amsellem
><ma...@systar.com>>
>Reply-To: "users@flex.apache.org<ma...@flex.apache.org>"
><us...@flex.apache.org>>
>Date: Wednesday, July 31, 2013 9:52 AM
>To: "users@flex.apache.org<ma...@flex.apache.org>"
><us...@flex.apache.org>>
>Subject: Problem with PopupManager
>
><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>xmlns:s="library://ns.adobe.com/flex/spark">
>    <s:Button id="btPopup2" top="80" right="50" label="Pop2"
>click="btPopup2_clickHandler(event)"/>
>    <fx:Script><![CDATA[
>        import mx.managers.PopUpManager;
>        private function btPopup2_clickHandler(event:MouseEvent):void {
>            var panel: Panel = new Panel();
>            with(panel){
>                id="panel";
>                title="Panel2";
>                width=200;
>                height =150;
>            }
>            PopUpManager.addPopUp(panel,btPopup2);
>            PopUpManager.centerPopUp(panel);
>        }
>        ]]></fx:Script>
></s:Application>
>


Re: Problem with PopupManager

Posted by Alex Harui <ah...@adobe.com>.
I think all I would add is popup.x = Math.min(popup.x,
systemManager.screen.right - popup.width);

On 7/31/13 12:22 PM, "Maurice Amsellem" <ma...@systar.com>
wrote:

>Thanks,  I will raise a feature request for that.
>
>In the meantime, I intend to adapt some of the logic from PopupAnchor
>(functions calculatePopUpPosition():Point and determinePosition) into
>PopupWrapper subclass.
>
>Do you think it's a good idea ?
>
>Maurice 
>
>-----Message d'origine-----
>De : Alex Harui [mailto:aharui@adobe.com]
>Envoyé : mercredi 31 juillet 2013 21:13
>À : users@flex.apache.org
>Objet : Re: Problem with PopupManager
>
>There is to right side bounds checking in PopUpManager.  Probably a good
>feature to request.
>
>-Alex
>
>From: Maurice Amsellem
><ma...@systar.com>>
>Reply-To: "users@flex.apache.org<ma...@flex.apache.org>"
><us...@flex.apache.org>>
>Date: Wednesday, July 31, 2013 9:52 AM
>To: "users@flex.apache.org<ma...@flex.apache.org>"
><us...@flex.apache.org>>
>Subject: Problem with PopupManager
>
><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>xmlns:s="library://ns.adobe.com/flex/spark">
>    <s:Button id="btPopup2" top="80" right="50" label="Pop2"
>click="btPopup2_clickHandler(event)"/>
>    <fx:Script><![CDATA[
>        import mx.managers.PopUpManager;
>        private function btPopup2_clickHandler(event:MouseEvent):void {
>            var panel: Panel = new Panel();
>            with(panel){
>                id="panel";
>                title="Panel2";
>                width=200;
>                height =150;
>            }
>            PopUpManager.addPopUp(panel,btPopup2);
>            PopUpManager.centerPopUp(panel);
>        }
>        ]]></fx:Script>
></s:Application>
>


RE: Problem with PopupManager

Posted by Maurice Amsellem <ma...@systar.com>.
Thanks,  I will raise a feature request for that.

In the meantime, I intend to adapt some of the logic from PopupAnchor (functions calculatePopUpPosition():Point and determinePosition) into PopupWrapper subclass.

Do you think it's a good idea ? 

Maurice 

-----Message d'origine-----
De : Alex Harui [mailto:aharui@adobe.com] 
Envoyé : mercredi 31 juillet 2013 21:13
À : users@flex.apache.org
Objet : Re: Problem with PopupManager

There is to right side bounds checking in PopUpManager.  Probably a good feature to request.

-Alex

From: Maurice Amsellem <ma...@systar.com>>
Reply-To: "users@flex.apache.org<ma...@flex.apache.org>" <us...@flex.apache.org>>
Date: Wednesday, July 31, 2013 9:52 AM
To: "users@flex.apache.org<ma...@flex.apache.org>" <us...@flex.apache.org>>
Subject: Problem with PopupManager

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark">
    <s:Button id="btPopup2" top="80" right="50" label="Pop2" click="btPopup2_clickHandler(event)"/>
    <fx:Script><![CDATA[
        import mx.managers.PopUpManager;
        private function btPopup2_clickHandler(event:MouseEvent):void {
            var panel: Panel = new Panel();
            with(panel){
                id="panel";
                title="Panel2";
                width=200;
                height =150;
            }
            PopUpManager.addPopUp(panel,btPopup2);
            PopUpManager.centerPopUp(panel);
        }
        ]]></fx:Script>
</s:Application>


Re: Problem with PopupManager

Posted by Alex Harui <ah...@adobe.com>.
There is to right side bounds checking in PopUpManager.  Probably a good feature to request.

-Alex

From: Maurice Amsellem <ma...@systar.com>>
Reply-To: "users@flex.apache.org<ma...@flex.apache.org>" <us...@flex.apache.org>>
Date: Wednesday, July 31, 2013 9:52 AM
To: "users@flex.apache.org<ma...@flex.apache.org>" <us...@flex.apache.org>>
Subject: Problem with PopupManager

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark">
    <s:Button id="btPopup2" top="80" right="50" label="Pop2" click="btPopup2_clickHandler(event)"/>
    <fx:Script><![CDATA[
        import mx.managers.PopUpManager;
        private function btPopup2_clickHandler(event:MouseEvent):void {
            var panel: Panel = new Panel();
            with(panel){
                id="panel";
                title="Panel2";
                width=200;
                height =150;
            }
            PopUpManager.addPopUp(panel,btPopup2);
            PopUpManager.centerPopUp(panel);
        }
        ]]></fx:Script>
</s:Application>