Add lines to UI figure

조회 수: 14 (최근 30일)
Khalil Khalil
Khalil Khalil 2021년 4월 5일
답변: Abhishek Chakram 2023년 10월 11일
I'm creating an app in App Designer and using an UI grid element to sort the UI components, arranging them in a table-like manner. Is there a way to add lines or make the lines of the grid element visible? I know that I could use a UI table but my app idea doesn't fit the functionality of the table element.

답변 (1개)

Abhishek Chakram
Abhishek Chakram 2023년 10월 11일
Hi Khalil Khalil,
It is my understanding that you want to show the grid lines of the “uigridlayout”. To achieve this, you can use “uipanel” inside “uigridlayout” in the “startupFcn” function of the application. Here is a sample code for the same:
function startupFcn(app)
% Create a UIGridLayout with 2 rows and 2 columns
gridLayout = uigridlayout(app.UIFigure, [2, 2]);
% Create the first UIPanel
panel1 = uipanel(gridLayout);
panel1.Layout.Row = 1;
panel1.Layout.Column = 1;
% Set other properties of panel1 as desired
% Create the second UIPanel
panel2 = uipanel(gridLayout);
panel2.Layout.Row = 1;
panel2.Layout.Column = 2;
% Set other properties of panel2 as desired
% Create the third UIPanel
panel3 = uipanel(gridLayout);
panel3.Layout.Row = 2;
panel3.Layout.Column = 1;
% Set other properties of panel3 as desired
% Create the fourth UIPanel
panel4 = uipanel(gridLayout);
panel4.Layout.Row = 2;
panel4.Layout.Column = 2;
% Set other properties of panel4 as desired
end
You can refer to the following documentation to know more about the functions used:
Best Regards,
Abhishek Chakram

카테고리

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

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by