Scrollbar not appearing in a Tab

19 views (last 30 days)
Phillip Wollschläger
Phillip Wollschläger on 20 Feb 2022
Edited: Nivedita on 9 Nov 2023
Im trying to add a scrollbar to one Tab of my application, but it just doesnt seem to work.
The following image shows the Tab in question and also the hierarchy of the GUI components:
Both the Tab (app.PlotTab) and the GridLayout (app.PlotGridLayout) have their scrollable property set to true.
Now the basic idea is, that a number of plots can be generated via the "Basic Config" Tab and those will then be put into the app.PlotGridLayout. If those plots dont fit into the current size of the window a scrollbar should appear so the user could scroll to the plots that are outside of the visible window.
The plots are generated by this code:
no_total_axes = no_x_axes * no_y_axes;
no_columns = no_x_axes;
no_rows = no_y_axes;
%app.PlotGridLayout.RowHeight = repmat({300}, 1, no_rows);
for column = 1:no_columns
for row = 1:no_rows
c_ax = axes(app.PlotGridLayout);
app.allAxes{row, column} = c_ax;
app.PlotGridLayout.ColumnWidth{row} = 'fit';
hold(c_ax, "on");
for line_no = 1:no_tables
selectedTable = app.dataMap(app.TablesListBox.Value{line_no});
plot(c_ax, selectedTable.(app.XAxesListBox.Value{column}), selectedTable.(app.YAxesListBox.Value{row}));
end
hold(c_ax, "off");
c_ax.Layout.Row = 1;
c_ax.Layout.Column = row;
end
end %for column
The plot creation works fine, but as said, if there are too many plots then some of them will be beyond the end of the window and thus be not visible (and since there is no scrollbar also not reachable).

Answers (1)

Nivedita
Nivedita on 9 Nov 2023
Edited: Nivedita on 9 Nov 2023
Hello Philip,
I understand that you are facing an issue with obtaining a scrollbar to one of the tabs in your application.
As you have mentioned that you have set the "Scrollable" property of both the tab and the grid layout to "True". The behaviour of the "Scrollable" property of the Grid Layout in MATLAB App Designer works differently. In order to scroll, the following conditions must be met:
  • The sum of the values specified for the 'RowHeight' property of the grid layout manager must be larger than the height of the parent container.
  • The sum of the values specified for the 'ColumnWidth' property of the grid layout manager must be larger than the width of the parent container.
  • At least one row or column of the grid layout manager must be set to a fixed pixel height or width.
  • The grid layout manager must contain components.
For more information on the properties of "Grid Layout", refer to the following documentation link:
I hope this helped!
Regards,
Nivedita.

Categories

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

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!