How to modify a cutom UI component

조회 수: 3 (최근 30일)
Maura Monville
Maura Monville 2022년 6월 6일
답변: Rahul 2025년 3월 18일
I am trying to edit a custom UI component (attached). I need to add an editable Text field side-by-side each Checkbox.
I though I could just open the custom component with the Designer. Then drag and drop the Edit Fields onto the GridLayout.
Unluckily regardless of the control I pick from the component library, I cabnnot drop it onto the GridLayout. It does not stick to it.
My question is:
Shall I add regular components to the GridLayout programmatically, that is changing the generated code?
Otherwise?
Thank you in advance
Maura

답변 (1개)

Rahul
Rahul 2025년 3월 18일
As I understand from the given 'mlapp' file, you are trying to set a 'GridLayout' in your app where the 'ColumnWidth' and 'RowHeight' properties are set to 'fit' which provides limited space for each column and row based on the component inside the cell.
In order to add a Text Field beside the Checkbox, consider following the given steps:
  • The Edit TextField component of App Designer has two components, one is the Label of the TextField and one is the TextField. Hence, based on your requirement of adding the Label or not, add one or two columns to the GridLayout repectively.
  • Columns can be added in the following way: Inside the 'ColumnWidth' property of Grid Layout, add another 'fit' to create another column. Incase Label of the TextField is to be accomodated, it is best to add another column.
  • Now, add the Edit TextField component to the new column/columns added. Thois component would take the space of 2 columns.
  • Incase the Label for the TextField is not required and you can see that the Default Label is overlaid on the Checkbox text, then select the Label and delete it directly.
Here is an example:
The following MathWorks documentations can be referred to know more:
Thanks.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by