开发者

DateChooser updating correctly only if visible at start

I'm writing a Flex application and I came across what I think is a weird problem.

I want to create a text box and a DateChooser as the datefield didn't do what I wanted and it's Halo so I can't skin it easily. I want the DateChooser to show when I click on the text input. Here is an except from my code:

    <s:TextInput id="wholeDate" width="100"  
                 mouseOver="stopChangeToNormal();"
                 paddingRight="10"
                 click="date1.visible = true"
                 focusOut="date1.visible = false"/>
    <s:Button label="Go" width="70" />
</s:Panel>

<mx:DateChooser id="date1" 
                visible = "false"
                change="useDate(event);" 
                mouseOver="changeToNormalState = false;" 
                y="{wholeDate.y + buttonsGroup.y + 20}"
                x="{wholeDate.x + buttonsGroup.x - 175 }" />    

The weird thing is that it works if I make it visible = "true" to start, but if I have it visible="false" it doesn't work! It shows, but the date I select doesn't show in the box as it does if I hav开发者_如何转开发e it as visible="true", but I don't want it to be visible initially.

Any ideas?


I don't think its actually anything to do with the initial visibility of the DateChooser. Have you verified that your event handlers are indeed called, and in an order that makes sense? The problem appears to be that when you attempt to make a selection in the DateChooser, the TextInput gets a focusOut event, which hides the DateChooser, which apparently prevents it from receiving the selection event. I think you need to be more selective about when you actually hide the DateChooser. Perhaps you need to defer the hiding so it has a chance to respond to the selection first.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜