如何使用 Playbook 的 QNX 显示带有一项的选取器
我有一个 QNX 选择器控件,当选择器中只有一项时,该控件不会显示所选值。例如:
import qnx.ui.picker.Picker;
var pick:Picker = new Picker();
var arr:Array = [{label: "hi!"}];
pick.dataProvider = new DataProvider([new DataProvider(arr)]);
pick.selectedIndices = [0];
addChild(pick);
结果是一个空白选择器。也许我做错了什么。当 arr 数组中有 2 个项目时,选择器实际上显示选定的索引。
当只有 1 个项目可供选择时,如何让选择器显示所选项目?
我正在使用 Burrito 和 Playbook SDK 0.9.3。
提前致谢!
I've got a QNX Picker control that isn't displaying the selected values when there's only one item in the picker. For example:
import qnx.ui.picker.Picker;
var pick:Picker = new Picker();
var arr:Array = [{label: "hi!"}];
pick.dataProvider = new DataProvider([new DataProvider(arr)]);
pick.selectedIndices = [0];
addChild(pick);
The result is a blank picker. Maybe I'm doing something wrong. When there are 2 items in the arr Array, the picker actually shows the selected Indices.
How do I get the picker to display the selected item when there is only 1 item to choose from?
I'm using Burrito, with Playbook SDK 0.9.3.
Thanks in advanced!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您将在某个时候填充选择器以便实际使用它,因此您可以只使用现有的数组并添加一个空白条目:
var arr:Array = [{标签: "hi!"}, {标签: ""}];
然后在添加新数据之前弹出数组以删除空白项。
I assume that you are going to populate the picker at some point in order to actually use it, so you could just use your existing array and add a blank entry:
var arr:Array = [{label: "hi!"}, {label: ""}];
and then pop the array to remove the blank item before you add new data.