[英]Flex 3 DateChooser Control - Date Selection Changes on MouseUp Event
如果在文本控件旁邊有一個DateChooser控件,並且單擊鼠標左鍵以選擇文本,然后在datechooser控件上方繼續按住鼠標按鈕並向上移動鼠標按鈕,則selectedDate值將變為您懸停的日期過度。 我有用戶遇到此問題,並且由於兩個控件的接近而無意中發生。 我找不到辦法阻止這種效果。 基本上我希望selectedDate只在用戶實際點擊日歷控件時改變,即。 mouseDown或單擊。 在這些事件中調用函數不會更改此行為。 我需要一種方法來禁止控件更改mouseUpEvent上的日期(我認為)。
這是一個令人惱火的錯誤,因為你無法取消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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.