简体   繁体   English

Flex / AIR:DropDownList并非总是在单击时打开

[英]Flex/AIR: DropDownList doesn't always open on click

I have an AIR application with 2-3 DropDownLists and a bunch of other controls. 我有一个带有2-3个DropDownLists和其他控件的AIR应用程序。 The DropDownLists are bound to dataproviders (ArrayCollections) in a central Model singleton. DropDownList绑定到中央Model单例中的数据提供者(ArrayCollections)。 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. 但是,当我单击按钮将新对象添加到同一模型中另一个ArrayCollection中的对象时,DropDownLists变得很奇怪。 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. 进行其他选择将使DropDownList再次起作用,但是其他选择可能仍然拒绝打开。

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. 如果我使用Ctrl +向下箭头打开下拉列表,则下拉列表将一直运行,因此仅单击不能正确触发打开。 I can work around the problem by calling openDropDown() on the dropdown when clicked, but that doesn't feel right. 我可以通过在单击时在下拉列表上调用openDropDown()来解决此问题,但是感觉不对。

I'm using the 4.1 SDK, and the dropdowns are s:DropDownLists. 我使用的是4.1 SDK,下拉列表为s:DropDownLists。 I tried using mx:ComboBoxes instead, but got the same behavior. 我尝试使用mx:ComboBoxes代替,但行为相同。 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. 编辑:奇怪的是,使用s:ComboBoxes可以正常工作,但我真的不希望使用它们,因为它们似乎无法变为不可编辑的。

Has anyone run into this before and managed to solve it? 之前有人遇到过并设法解决吗? Any suggestions are welcome. 欢迎任何建议。

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. 经过大量的修改后,似乎出现问题了,当我有一个ToggleButtonBar时,它具有基于视图所具有的表示模型中的属性来设置其enabled属性。 The other controls handle 其他控件句柄

enabled="{model.certainObject != null}"

perfectly fine, but not the ToggleButtonBar. 很好,但不是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...=/ 猜猜我不会使用ToggleButtonBar ... = /

First thing to check: Are you ArrayCollections marked Bindable in your Model Singleton? 首先要检查:您在模型单例中是否将ArrayCollections标记为Bindable? Are your ArrayCollections bound to the values in the Model Singleton? 您的ArrayCollection是否绑定到Model Singleton中的值?

Binding is a strange beast; 束缚是一种奇怪的野兽。 and if you are putting a lot of Bindable properties inside a single object; 并且如果要在单个对象中放置很多Bindable属性; 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. 如果yu有很多不同的视图都绑定到同一Singleton对象,则可以在应用程序中波动。

Another thing to check: I have seen really weird results if you use the same Collection as the dataProvider to multiple ComboBoxes. 要检查的另一件事:如果您对多个ComboBox使用与dataProvider相同的Collection,那么我会看到非常奇怪的结果。 ( I assume the same odd behaviour would persist if using a multiple DropDownLists ) (我假设如果使用多个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? 您可以提供一个可运行的示例来演示您的问题吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM