8 Replies Latest reply on Nov 9, 2007 2:39 PM by Glen_Simmons

    Am I modal?

      Is there a way to find out whether there's a modal popup up? I have a global key event handler that shouldn't do its thing if a modal dialog is up. And since modal apparently doesn't really mean modal, I need to check for it.

      Glen Simmons
        • 1. Re: Am I modal?
          dimival Level 1
          I don't think there's a property or method which indicates what you need, but you could do it on you own. Just declare a boolean variable in your application whose value will depend on the value you pass to the addPopUp and createPopUp methods. So if you set your PopUp to be modal then set your global boolean variable to true and so.

          Hope this helps
          • 2. Re: Am I modal?
            Glen_Simmons Level 1
            So I'll have to remember to update the value in every place I put up a dialog and also in every place I remove them. Not optimal. This seems like a pretty large hole in the framework. Oh well, thanks anyway.

            • 3. Am I modal?
              dimival Level 1
              You could do the following too:

              Extend the PopUpManager class and add a boolean variable. Then "override" the createPopUp and addPopUp methods so they update the boolean value for you, then call the superclass addPopUp and createPopUp methods. Finally add a method to check the value of your boolean status.

              What do you think? It is a lot cleaner and helps you solve your problem

              • 4. Re: Am I modal?
                Glen_Simmons Level 1
                That's much better. Still seems like something the framework oughta provide. :)

                • 5. Am I modal?
                  dimival Level 1
                  Yep you got a big point there :P maybe you should send your request to the Adobe Team, i think there's an URL for requesting functionality, give it a shot maybe they will include it in time for the Flex 3 release.

                  Glad to help, don't forget to mark this topic as closed by marking a post as the answer :)
                  • 6. Re: Am I modal?
                    mae@ccg Level 1
                    As an alternative, take a look at the SystemManager class.

                    It's got crazy methods like:

                    From the help docs:

                    The SystemManager maintains multiple lists of children, one each for tooltips, cursors, popup windows. This is how it ensures that popup windows "float" above the main application windows and that tooltips "float" above that and cursors above that. If you simply examine the numChildren property or call the getChildAt() method on the SystemManager, you are accessing the main application window and any other windows that aren't popped up. To get the list of all windows, including popups, tooltips and cursors, use the rawChildren property.

                    Hope that helps too.
                    • 7. Re: Am I modal?
                      dimival Level 1
                      Awesome mae@ccg!!! That's exactly what Glen needs

                      I had no idea that class hold the answer for this, thanks for sharing you knowledge
                      • 8. Re: Am I modal?
                        Glen_Simmons Level 1
                        Yep, that should do it. Seems like PopupManager oughta have a method for finding out if there's a modal popup up, but …