找回密码
 注册
Simdroid-非首页
查看: 108|回复: 3

[PCL] 如何实现在列表中每次只能选一项

[复制链接]
发表于 2011-2-27 18:17:28 | 显示全部楼层 |阅读模式 来自 浙江杭州
请问大家,如何用PCL中实现下列表选项中,每次点击鼠标只能选择一项,而不能象图所示,可以选择多项。敢问是不是在ui_wid_get( listbox_id1, "NSELECTED",group_number ) 和ui_wid_get( listbox_id1, "VALUE",group_items )中如何修改。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
发表于 2011-2-27 21:24:32 | 显示全部楼层 来自 上海
Simdroid开发平台
本帖最后由 kalaok 于 2011-2-27 21:26 编辑

帮助里面写的很清楚了
ui_listbox_create( parent, callback, x, y, width, num_rows, label, selection_type, sort )
STRING  selection_type  “BROWSE”, “EXTEND”, “MULTIPLE”, or “SINGLE”. See selection_type Modes.  

Four different selection_type modes exist for the listbox, as follows:

Single  Allows only one pick at a time. Here, pressing down on an item will automatically pick it. Any scrolling done afterwards or a releasing of the mouse button on another item will be inconsequential. Arrow keys highlight subsequent items which also selects one at a time.  

Browse  Allows only one selection to be made at a time. Pressing down on an item only initiates picking, then you may scroll up and down through the other choices without making a selection. As the cursor moves over the items, the item corresponding to the cursor location will become highlighted. Releasing the mouse button on the highlighted item makes the selection. Keyboard selection works the same for browse mode as for single mode.  

Multiple  Allows picking of more than one item by clicking each one separately. It will also toggle off previously highlighted items. The arrow keys highlight the items while the space bar selects and deselects them.  

Extend  Also permits multiple picking of items. Pressing down on the left mouse button with the cursor on the first (base) item desired will initiate picking. Next, dragging through any adjacent items will highlight them also. These highlights are temporary and can be changed by dragging elsewhere in the listbox. Releasing the mouse button on another item will pick all items between the base and last item inclusively.  

也就是说selection_type应该选SINGLE
回复 不支持

使用道具 举报

发表于 2011-2-27 21:30:51 | 显示全部楼层 来自 上海
另外修改widget的属性是用ui_wid_set,获取信息才是ui_wid_get
你也可以通过ui_wid_set(wid,"SELECTIONTYPE",“SINGLE")来实现每次只选择一项
回复 不支持

使用道具 举报

 楼主| 发表于 2011-2-28 19:19:53 | 显示全部楼层 来自 浙江杭州
非常感谢您,按你的方法,我得到了自己所要的效果,真心的谢谢。
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-4-28 08:34 , Processed in 0.026770 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表