Add lines to UI figure

13 views (last 30 days)
Khalil Khalil
Khalil Khalil on 5 Apr 2021
Answered: Abhishek Chakram on 11 Oct 2023
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.

Answers (1)

Abhishek Chakram
Abhishek Chakram on 11 Oct 2023
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

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!