1 Reply Latest reply on Apr 11, 2009 11:59 AM by ergo_eleven

    HELP! Problems position PopUp Window when called from a DataGrid cell


      Hi there,


      I have a DataGrid and one of the columns displays an itemRenderer of an icon when there is additional information to be viewed. That all works fine. When the user clicks on the icon it launches a popup window over the application displaying the additional information. That works fine.


      The thing I'm having trouble with, is that the popup window is always placed so its upper left corner is right over the clicked icon. This causes much of the popup window to be clipped off the screen. Sure it can be manually dragged back into full view again but that's not elegant.


      I've used popup windows before with the center method for example:




      and that works fine. But something is different since I'm calling this popup window from an itemRenderer in a dataGrid. The Center method doesn't make any difference. Manually inputting x and y values in the TitleWindow doesn't make it change position either. The window just always opens up and positions itself so the the upper left corner is over the icon that was clicked and launched it.


      Any ideas on how to control where this popup TitleWindow appears upon a click from this dataGrid?



        • 1. Re: HELP! Problems position PopUp Window when called from a DataGrid cell

          See kmdguy, PopUpManager needs to know to whom attach a popup object. For this purposes the second parameter of PopUpManager.addPopUp() is the parent DisplayObject in which display list this popup will be placed. So in you custom renderer you must provide the parent. You may use global pointer such as Application.application (but also there is parentDocument, parentApplication - chose proper for you purposes). Consider the folowing method for example:


          private function showButton () : void
              var button : Button = new Button();
              button.label = "test";
              PopUpManager.addPopUp(button, Application.application as DisplayObject);


          Good luck!