8 Replies Latest reply on Jan 28, 2007 6:53 PM by dimival

    Title WIndow + DataGrid BUG

    dimival Level 1
      I am using the PopUpManager to create as a pop-up a TitleWindow which contains a DataGrid with some elements.

      Whenever i select an item from the DataGrid i dispatch an event to notify the parent application and then I remove the PopUp like this:

      <mx:DataGrid change="myFunction(event)/>

      public function myFunction(event:Event):void
      {
      //Logic to dispatch a custom event
      PopUpManager.removePopUp(this);
      }

      The thing is this is causing an error in the Flex SDK classes, the error says:

      TypeError: Error #1009: Cannot access a property or method of a null object reference
      at mx.controls.listClasses::ListBase/::mouseIsUp():[ListBase.as:7029]
      at mx.controls.listClasses::ListBase/mx.controls.listClasses:ListBase::mouseUpHandler():[Lis tBase.as:7060]
      at mx.controls::DataGrid/mx.controls:DataGrid::mouseUpHandler():[DataGrid.as:4211]


      So what's the deal here??? I am removing the popUp on the change event of the DataGrid and it fails, why is that?
      If i change it so the change event only dispatches the event and then I manually close the popup using the close button then it works, but it doesn't work when i try to close the PopUp from the change event of the DataGrid.

      Any ideas? is it a bug?
        • 1. Re: Title WIndow + DataGrid ERROR
          Level 1
          Lucky for you, some poor soul has already excercised this demon.

          http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=585&threadid =1232258&highlight_key=y&keyword1=module

          This is assuming you are using 2.0.1, which it sounds like you are.

          --Andy
          • 2. Title WIndow + DataGrid ERROR
            dimival Level 1
            Thanks Andy for your reply, i was starting to think that i was being ignored in this forum :P

            So it is a bug of the new release 2.0.1, aren't version upgrades suppose to correct bugs instead of causing more?

            So it seems that the only workaround is to use this:
            callLater(PopUpManager.removePopUp, [this]);

            Anyone from Adobe that can confirm this? is this the only way to solve the bug? is a bug report already written for this bug?
            • 3. Title WIndow + DataGrid ERROR
              ur_dtrain Level 1
              If you manage your popup from the parent/application scope you shouldn't run into this problem - you simply need to keep track of the object return from the createPopUp.

              public var imagePopUp:IFlexDisplayObject;
              imagePopUp=PopUpManager.createPopUp(this, views.SavedNotice, false);

              Then use the reference when closing:
              if(imagePopUp != null){
              PopUpManager.removePopUp(imagePopUp);
              imagePopUp = null;
              }
              • 4. Re: Title WIndow + DataGrid ERROR
                dimival Level 1
                Already tried that, remember i send an event to the parent? Well i tried to remove the PopUp from there too, and it is the same result. The point is that the DataGrid still has some unfinished operation that is executed after the popup window has been closed (no matter if you close it on the popup itself or on the parent)

                Which version of Flex are you using by the way?
                • 5. Title WIndow + DataGrid ERROR
                  ur_dtrain Level 1
                  I've used it in 2.0 and 2.0.1 (but not with a data grid involved). Perhaps you could try using updateComplete as the trigger event? Otherwise stage the code to, for example, removeChild or disable the data grid before calling removePopup. I can't think of why the grid would still be trying to process something, unless it is performing a sort or some other computation (custom renderers?).

                  All else fails, use a timer to delay the removePopup by a couple hundred milliseconds.
                  • 6. Re: Title WIndow + DataGrid ERROR
                    dimival Level 1
                    This is what the DataGrid tries to do after the popUp is closed:

                    TypeError: Error #1009: Cannot access a property or method of a null object reference
                    at mx.controls.listClasses::ListBase/::mouseIsUp():[ListBase.as:7029]
                    at mx.controls.listClasses::ListBase/mx.controls.listClasses:ListBase::mouseUpHandler():[Lis tBase.as:7060]
                    at mx.controls::DataGrid/mx.controls:DataGrid::mouseUpHandler():[DataGrid.as:4211]

                    This didn't happen in Flex 2.0, which makes me believe it is a Flex 2.0.1 bug, and i hope Adobe can solve it (it worked before) for a next update.

                    It seems that the workaround will be to delay the call to RemovePopUp as you mention, either by using a timer or by using the CallLater( ) method.

                    I would like to know if Adobe has a better workaround and if they are aware of this bug
                    • 7. Re: Title WIndow + DataGrid BUG
                      FlightGuy Level 1
                      I dare say they are aware of it - follow the link posted by awclemen above and try my suggestion about using callLater in the event handler to close the PopUp. The problem you're describing is precisely the same thing I had and that did fix it. You could report it as a bug if you like - go to http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform&product=20

                      It's not necessary to shout "BUG" in your post - everybody who responds to your posts does so voluntarily and are more likely to do so if you're a little more civil.

                      Tim
                      • 8. Re: Title WIndow + DataGrid BUG
                        dimival Level 1
                        I read your post before, i am aware of your workaround thanks, i just want to know if adobe has another work around for it.