Flex/AIR:DropDownList 并不总是在单击时打开
我有一个带有 2-3 个 DropDownList 和一堆其他控件的 AIR 应用程序。 DropDownList 绑定到中央模型单例中的数据提供者 (ArrayCollections)。启动后,它们都工作正常。
但是,当我单击按钮将新对象添加到同一模型中另一个 ArrayCollection 中的对象时,DropDownList 会变得很奇怪。它们仍然记录点击,所有其他控件仍然像以前一样工作,但下拉菜单不会打开。单击/等待足够时间通常会打开下拉菜单,但如果我不进行其他选择,它在关闭后仍然不会打开。进行不同的选择会使 DropDownList 再次工作,但其他列表可能仍然拒绝打开。
如果我使用 Ctrl + 向下箭头打开下拉菜单,它们始终有效,因此只有单击无法正确触发打开。我可以通过在单击下拉菜单时调用 openDropDown()
来解决该问题,但这感觉不对。
我使用的是 4.1 SDK,下拉列表是 s:DropDownLists。我尝试使用 mx:ComboBoxes 代替,但得到了相同的行为。 编辑:奇怪的是,使用 s:ComboBoxes 它们可以正常工作,但我真的不想使用它们,因为它们似乎无法变得不可编辑。
有没有人遇到过这个问题并设法解决它?欢迎任何建议。
I have an AIR application with 2-3 DropDownLists and a bunch of other controls. The DropDownLists are bound to dataproviders (ArrayCollections) in a central Model singleton. On launch, they all work fine.
However, when I click a button to add new objects to an object in another ArrayCollection in the same Model, the DropDownLists get weird. They still register clicks, and all other controls still work as before, but the dropdowns won't open. Clicking/waiting enough usually opens the dropdown, but if I don't make another selection it still won't open after closing. Making a different selection makes that DropDownList work again, but the others might still refuse to open.
If I open the dropdowns using Ctrl + Down arrow, they work all the time, so it's only the click that doesn't trigger the open correctly. I can work around the problem by calling openDropDown()
on the dropdown when clicked, but that doesn't feel right.
I'm using the 4.1 SDK, and the dropdowns are s:DropDownLists. I tried using mx:ComboBoxes instead, but got the same behavior. Edit: Weirdly enough, using s:ComboBoxes they work as they should, but I really don't want to use them since they seemingly can't be made non-editable.
Has anyone run into this before and managed to solve it? Any suggestions are welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过大量修改后,当我有一个 ToggleButtonBar 时,问题似乎出现了,该 ToggleButtonBar 的
enabled
属性是基于视图的表示模型中的属性设置的。其他控件处理得很好,但 ToggleButtonBar 则不然。它按应有的方式设置属性,但不知何故似乎导致了我一直遇到的下拉问题。我想我不会使用 ToggleButtonBar...=/
After a whole lot of tinkering with this, it seems that the problem appears when I have a ToggleButtonBar which has its
enabled
attribute set based on an attribute in the presentation model I have for the view. The other controls handleperfectly fine, but not the ToggleButtonBar. It sets the attribute as it should, but somehow seems to cause the dropdown problem I've been having. Guess I won't be using a ToggleButtonBar...=/
首先要检查:您的 ArrayCollections 是否在模型单例中标记为 Bindable?您的 ArrayCollections 是否绑定到模型单例中的值?
绑定是一头奇怪的野兽;如果您将大量 Bindable 属性放入单个对象中;我知道其中一个属性的更改可能会触发所有可绑定属性的机会;如果你有很多不同的视图都绑定到同一个 Singleton 对象,这可能会影响应用程序。
另一件需要检查的事情是:如果您使用相同的 Collection 作为多个 ComboBox 的 dataProvider,我会看到非常奇怪的结果。 (我假设如果使用多个 DropDownList,同样的奇怪行为会持续存在)
但是,我只是在这里猜测。您的代码很可能有问题。您能提供一个可运行的示例来演示您的问题吗?
First thing to check: Are you ArrayCollections marked Bindable in your Model Singleton? Are your ArrayCollections bound to the values in the Model Singleton?
Binding is a strange beast; and if you are putting a lot of Bindable properties inside a single object; I understand that a change in one can trigger a chance in all bindable properties; which can ripple through the app if yu have a lot of different views all binding to that same Singleton object.
Another thing to check: I have seen really weird results if you use the same Collection as the dataProvider to multiple ComboBoxes. ( I assume the same odd behaviour would persist if using a multiple DropDownLists )
But, I'm just guessing here. Most likely something is off in yor code. Can you provide a runnable sample to demonstrate your problem?