1 Reply Latest reply on Jun 3, 2009 2:39 PM by -Hob

    Set event for target phase only (original problem: prevent ADG to move row when Enter is pressed)

    david.bonafe

      I'm writing a visual component that can be used inside or outside an ADG, it has some functionalities when the user press ENTER when it's focused.

       

      The problem started when I tried to use it as an ItemEditor, as ENTER always move the grid selection to next row and break my component behavior. So I started my hunt for a hack, and ended up with extending ADG, adding an event listener at capture phase for an ENTER key down and preventing it from propagating. Ok, the grid doesn't move the selection to next row anymore, but it doesn't trigger my component functionality either.

       

      Then, thinking as a Win32 developer that I am, I tried the following, check if there's a valid item editor and dispatch another key down event directly into it. New problem, I get stack overflow because the "new" event is getting caught again at capture phase by the grid listener previously mentioned.

       

      So the obvious solutions would be:

       

      1) dispatch a target phase only event, which Flex docs implies it's impossible

      2) make a custom event for ENTER key and forget about Key Down event, which is "almost" impossible, because we have a ton of other components that can be used as renderer/editor and we'd need to check them one by one if their behavior depends on ENTER key down event and fix it.

       

      Now I'm trying to think about ways that doesn't require me to review/change a ton of code. Any suggestions on this is welcome.

       

      Thanks in advance,

       

      David