Add lines to UI figure

14 次查看(过去 30 天)
Khalil Khalil
Khalil Khalil 2021-4-5
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