How do I get a window scrollable after I adjust app.UIFigure.Position through a Callback?

5 views (last 30 days)
I am creating an application through app designer that requires insertion of components/fields depending on user need. I think I've figured out how to add new fields based on a pushed-button callback. In the same callback, I try to resize the app.UIFigure.Position to allow space to include these new components/fields for user input, but when I change it from, for example:
app.UIFigure.Position = [100 100 1616 1152] to app.UIFigure.Position = [100 100 1616 6000], there is no scroller for the new space created. I want to add another row of components/fields for user input at the bottom of a long list of components that already exist when it is set to app.UIFigure.Position = [100 100 1616 1152]. In the button callback, I change app.UIFigure.Position = [100 100 1616 6000] and input app.uidropdown(app.UIFigure).Position = [100 100 215 22]. Since I changed the UIFigure to be 6000 (height), shouldn't the new drop down be positioned 100 from the bottom of the new height? The drop down does not end up in the right spot and doesn't seem like the app has been extended enough to allow scrollability even though I have that interactivity option checked. Any suggestions?
  2 Comments
Jiri Hajek
Jiri Hajek on 31 Jan 2023
Hi, your approach seems awkward and you seem to ignore features of appdesigner that could help you with this. Why don't use tiledlayout or a grid to take care of the individual components in youw app window? In such a case, when your components (fields) are placed in the grid and the user manipulates app window, the scrollablle grids adjust dynamically as expected.
Alexander Yang
Alexander Yang on 31 Jan 2023
Hi Jiri, thanks for the reply, I agree my approach is a bit awkward. I could just have a bunch of fields already loaded in from the start but the people who will be using the app requested 35+ rows of fields. I was trying to add a button to add/delete/reorder rows as they go. I hadn't considered the grid layout, because I assumed that the result would be the same (i.e., if I chang ethe size of the UIFigure then assign fields to a grid it may not populate.) I will try your approach. Am I correct in thinking that I can assign fields to grids that may not exist based on window size? The user would not be manipulating the app window size. For example if the window starts off with a 5x5 grid and I assign a field to the first column in the 6th row the window will automatically adjust and allow scrolling?
Thanks for your help.

Sign in to comment.

Answers (0)

Categories

Find more on Develop uifigure-Based Apps in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!