Flex HDividedBox prevent dragging
I'd love to be able to prevent dragging of a HDividedBox's divider based on a condition. for example:
<mx:HDividedBox id="hd1" liveDragging="true" dividerDrag="dividerDragHandler(event)"> <Canvas id="c1"/> <Canvas id="c2"/> </HDividedBox> private function dividerDragHandler(event:DividerEvent):void { if (_something > 10) { event.preventDefault(); } }
Any ideas how I can do something like that? And I'd rather not mess with the widths of the child canvases开发者_StackOverflow中文版. Thanks.
Perhaps not ideal, but a here's a hack of hiding the divider controls from flexexamples.
You can set a minWidth
on your canvas'. Try that.
The DividerEvent is dispatched on MouseEvent.MOUSE_MOVE
in the HBox, and it disregards preventDefault()
or stopImmediatePropagation()
, so those methods won't really do much there. This works:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:HDividedBox id="hd1" liveDragging="true">
<mx:Panel width="100" minWidth="40" id="c1"/>
<mx:Panel width="200" minWidth="100" id="c2"/>
</mx:HDividedBox>
</mx:Application>
i also found out that you can effectively remove drag handles and disable sizing of an HDividedBox or VDividedBox by setting the horizontalGap style value to zero.
精彩评论