3 Replies Latest reply on Oct 4, 2008 8:43 PM by Gregory Lafrance

    Programmatically setting menu item "enabled".

    Gregory Lafrance Level 6
      I have an AIR app that has a menu item that when selected launches a dialog.

      I need to set the enabled property of the menu item to false after it is selected, as only one instance of this dialog should be launched, and I don't want to make the dialog modal. I also need to set the enabled property to true when the dialog is closed.

      Do I do this through the defaultDataDescriptor?

      BTW, the dialog that launches is not a popup, it is in an AIR app in the main window, in what I call the "workarea".
        • 1. Re: Programmatically setting meni item "enabled".
          Level 7

          "Greg Lafrance" <webforumsuser@macromedia.com> wrote in message
          news:gc6k9e$ht9$1@forums.macromedia.com...
          >I have an AIR app that has a menu item that when selected launches a
          >dialog.
          >
          > I need to set the enabled property of the menu item to false after it is
          > selected, as only one instance of this dialog should be launched, and I
          > don't
          > want to make the dialog modal. I also need to set the enabled property to
          > true
          > when the dialog is closed.
          >
          > Do I do this through the defaultDataDescriptor?
          >
          > BTW, the dialog that launches is not a popup, it is in an AIR app in the
          > main
          > window, in what I call the "workarea".

          What is the code of your menu? MenuItems have an enabled property, but
          knowing you I'm guessing the problem is not that you don't know that.


          • 2. Re: Programmatically setting meni item &quot;enabled&quot;.
            Gregory Lafrance Level 6
            I found out how to disable it in the itemClick listener, now I just have to figure out how to re-enable when the user closes the dialog, but no doubt I will do it by manipulating the XMLListCollection dataProvider.
            • 3. Re: Programmatically setting meni item &quot;enabled&quot;.
              Gregory Lafrance Level 6
              I don't know if this is how I should do it, but I create an associative array Object and when I disable a menu item in the ItemClick event (if it is a menu item that should be disabled at that time), I store a reference to the menu item in the Object. Then when I close the dialog I use the reference to re-enable the menu item.