Flex HDividedBox/VDividedBox divider double-click event oddity

I ran across an interesting case today while looking into an issue for someone else related to capturing the double-click event on the divider for a HDividedBox. It’s a little tricky to get the event to be captured by Flex. A quick search of the interwebs turned up nothing but people with the same issue. There is even an open bug in the Adobe Flex bug tracker(you have to login) that seems to be the exact issue, but there is no resolution named. Through some quick experimentation I figured out you can get it to work like so:



    
          
          		
          
          
          		
	      
     
     
          

The specific resolution was to enable liveDragging and add the event to the divider itself(most people try to set it on the doubleClick property of the DividerBox).

Hopefully this post will be helpful to some people out there with the same issue!

7 Comments


  1. hi,
    I think you miss one point You need to set the doubleClickEnabled of the BoxDivider to be true, otherwise it wont trigger the event listener at all.


  2. Thanks for your reply Rocksoccer,

    You’re correct, I should have mentioned that you need to set doubleClickEnabled to true. I was more pointing out that if you -only- set the event it will not work as you might expect(like I did), and that you have to enable livedragging in order to capture it.

    Regards,
    -Daniel


  3. Thanks so much. Been stuck with this little problem for a few days.


  4. Hi,
    great post. How to handle the double click on the divider in HDividedBox and VDividedBox was exactly what i was looking for!
    Works perfect.
    Thanks.


  5. Thank you very much! Very much wanted functionality!


  6. Yes, it is true that doubleclicks are not fired from DividedBox – but not even single clicks are..

    The problem for me is that we have a HDividedBox with a Tree in the left part – and this tree is really hard on the performance when liveDragging is set to true (because of the re-drawing)

    So I really would like to know if anybody knows a way to get the click (-double as well) events fired – but without enabling liveDragging.

    /KE


  7. The problem stems from the appearance of the vertical drag line upon user’s mouse down on the divider. That element just floats above the divider, thus blocks any mouse event that occurs afterward (mouseUp). That’s why Click and DoubleClick event is never fired from the divider.

    When using ‘liveDragging’, we just forbid the drawing of the vertical drag line so the Click and DoubleClick events are fired normally.

    One possible solution is to alter the behavior of mouseDown handler of the divider so that it will wait a certain amount of time before it actually starts drawing the vertical drag line. Any mouseUp event during that time will cancel the drawing of the vertical drag line.

    Another alternative solution, in case you have the big tree on the left, is not to use the horizontal scrollbar of the tree. Instead, you can wrap the tree with a s:Group and a s:Scroller. So every time the HDividedBox redraws the left content, only the viewport of the s:Group is re-rendered, not the tree itself. That may helps.