2010-12-13 6 views
0

テキストコントロールの隣にDateChooserコントロールがあり、マウスを左クリックしてテキストを選択した場合は、マウスボタンを押したままマウスボタンを上に移動します日付調整コントロールでは、selectedDateの値があなたの上に乗っている日付に変わります。私はこれに問題を抱えているユーザーを持っており、2つのコントロールの近接性のために意図せずに発生します。私はこの効果を止める方法を見つけることができません。基本的には、ユーザーが実際にカレンダーコントロールをクリックした場合にのみ、selectedDateを変更する必要があります。 mouseDownまたはをクリックします。これらのイベントの関数を呼び出すことによって、この動作は変更されません。私はmouseUpEvent(私は思う)の日付を変更するコントロールを無効にする方法が必要です。Flex 3 DateChooserコントロール - MouseUpイベントの日付選択の変更

答えて

2

DateChooserのイベントをキャンセルすることはできないので、面倒なバグです。可能な解決策は次のとおりです。

<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600"> 
    <mx:Script> 
     <![CDATA[ 
      private function preventDateChooserBug(e:MouseEvent):void { 
       //set the mouseChildren property to false, not enabled because 
       //that could cause an irritating flickering when clicking the 
       //text input box for focus 
       dtc.mouseChildren = false; 

       //add the event listener to stage so we get the mouse up event even 
       //outside of the text input control 
       stage.addEventListener(MouseEvent.MOUSE_UP, function(e2:MouseEvent):void { 
        dtc.mouseChildren = true; 
       }); 

      } 
     ]]> 
    </mx:Script> 
    <mx:TextInput x="10" y="10" id="txt" mouseDown="preventDateChooserBug(event)" /> 
    <mx:DateChooser x="178" y="10" id="dtc" /> 
</mx:Application> 
+0

賢い!それはそれを修正し、私は何かを学んだ。ありがとうございました! – cheetoResearch

関連する問題