简体   繁体   中英

Variable amount of checkboxes (GUI matlab)

I have in my programmatic GUI the following listbox:

    h.listbox = uicontrol('style','listbox','units','pixels',...
                          'position',[10,175,200,200],...
                          'string',components_index);

This gives me an output containing a row of stocks in a listbox.

What I now want, is that in front of every stock, I have a checkbox. Keep in mind that the amount of stocks is variable.

Can anyone point towards a solution?

Thanks in advance,

Jonathan

_______________________________________________________________ --

After the help I've come up with the following:

Thanks, that's what I'm looking for. I have just one little problem now. I made the code for the uitable:

h.table = uitable('units', 'pixels', 'position', [10, 100, 200, 200], ...
                     'columnname', {'Yes/No'},...
                     'columnformat',{'logical'},...
                     'ColumnEditable', true,...
                     'rowname',components_index);

But I can't click on my textboxes. They all appear as they should, but can't change their value.

Try defining the Data field (eg, populating the checkbox column with false ):

components_index = {'one1','two2','three3'};
h.table = uitable('units', 'pixels', 'position', [10, 100, 200, 200], ...
                         'columnname', {'Yes/No'},...
                         'columnformat',{'logical'},...
                         'ColumnEditable', true,...
                         'rowname',components_index,...
                         'data',false(numel(components_index),1));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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