Does MatLab designer support inserting Text fields and CheckBoxes inside a ListBox?
1 view (last 30 days)
Show older comments
I have implemented a GUI built with C# and Windows Presentation Foundation (see attachment 'GUI.png').
I need to implement a similar GUI using Matlab designer (see attachment 'Dicom-App.png').
I would like every item in the 2nd ("Patient Struct") and 3rd Listbox ("Renamed Struct") to contain a string as well as a progressive number and also a CheckBox as displayed in the attached 'GUI.png'.
I would greatly appreciate getting access to examples of nested designer controls, if any.
Numbering the strings displayed in the 2nd and corresponding 3rd ListBox is crucial to visualize the relationship.
If controls nesting is not supported by MatLab designer, an alternative may be to synchronously scroll the 2nd and the 3rd ListBox.
Is there any example of ListBoxes synchronized scrolling?
Thank you so much
Maura (maura.monville@nhs.net)
0 Comments
Accepted Answer
Voss
on 24 May 2022
As far as I know, there is no support for nested controls.
Maybe using a uitable would work for what you want to do (synchronized scolling, checkboxes and associated text objects next to each other). You may want to use multiple uitables to get it right (i.e., one corresponding to what's now the 1st listbox and another one corresponding to the 2nd and 3rd listboxes).
3 Comments
Voss
on 24 May 2022
Edited: Voss
on 24 May 2022
"Is there any example of a Table contaiing other controls?"
A Table can contain columns of checkboxes or popupmenus (in addition to text, which can be constrained to be numeric or not). All of that behavior is controlled by the ColumnFormat property:
Several examples can be found in the documentation:
"I do not know how many strings I have to display in each ListBox. Such a number is only known at runtime."
I don't think this will be a problem with a Table. The Table's Position property sets the region covered by the table, and the Data property sets the number of rows and columns (and their contents) in the Table. The Table automatically turns vertical and horizontal scroll bars on and off appropriately, depending on whether all the Data fits in the region covered by the Position. So your code might set the Table(s)' Position(s) when the figure changes size, say, and set the Table(s) Data when the user makes selections to load a data set or the user changes whatever options that determine what goes into the Table(s).
The advantage of the Table over multiple listboxes is that synchronized scrolling is done by design in the Table, whereas it's difficult if not impossible to achieve the same effect using multiple listboxes, as you have found.
More Answers (0)
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!