在列表框内显示复选框 [英] Display checkbox inside a listbox

查看:158
本文介绍了在列表框内显示复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的(编程)Matlab GUI中,我有一个列表框uicontrol.

In my (programmatic) Matlab GUI, I have a listbox uicontrol.

我想要的是在每个选项前面显示复选框.当用户单击复选框时,该复选框将被标记(该元素将在以后的计算中被考虑).如果用户单击标签,则会以文本uicontrol显示所选选项的描述,以告知用户该选项的含义.

What I want is to display checkboxes in front of each option. When a user clicks the checkbox, it's marked (and the element will be considered during the calculations later). While if the user clicks the label, a description of the selected option will be displayed in a text uicontrol to inform the user what the option means.

基本上,我想要的功能类似于安装程序,您可以在其中选择要安装的组件,并可以通过单击它们来获得有关所述组件的信息(不一定将它们标记为已选中).

Basically, I want functionality similar to installation programs where you can select components to install and can get information about said components by clicking them (which does not necessarily mark them as selected).

是否可以使用复选框或类似的方法来做到这一点?

Is there a way to do this with checkboxes or something similar?

推荐答案

没有做到这一点的就绪"方法-列表框仅将纯字符串作为条目.

There's no "ready" way for doing that - as listboxes take only plain strings as entries.

您可以手动"绘制适合列表框区域的绘制复选框,但这可能意味着要进行大量工作才能使所有功能正常工作... 另一种选择是使用Java组件-例如使用matlab中可用的jide组件.参见例如

You could "manually" draw checkbox fitted into the area of the listbox, but that might mean quite a lot of work to get everything working... Another alternative is to go for a java-componenent - e.g. using the jide components available in matlab. See e.g.

http://undocumentedmatlab.com/blog/using-jide-combo-boxes /

举几个例子.

这篇关于在列表框内显示复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆