Does MatLab designer support inserting Text fields and CheckBoxes inside a ListBox?

1 view (last 30 days)
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)

Accepted Answer

Voss
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).
Documentation: uitable | Table Properties
  3 Comments
Voss
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.
Maura Monville
Maura Monville on 8 Jun 2022
Thank you.
The problem is that I am developing a GUI.
The app Designer allows me to open figure on top of the GUI but it is not part of the GUI
The designer contain the control 'Table'. I will experiement with that to see if it is possible to achieve the same functionalities available with uitable.

Sign in to comment.

More Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!