フィルターのクリア

Appdesigner uicontrol position and resize

11 ビュー (過去 30 日間)
I2M
I2M 2021 年 1 月 14 日
コメント済み: Mario Malic 2021 年 1 月 14 日
I want to know how to control on any computer the app position whatever the screen size.
When I use the guide it was easy I use the following code
scrsz = get(0,'ScreenSize');
scrsz=[scrsz(1)+0.005*scrsz(3),scrsz(2)+0.8*scrsz(4),round(scrsz(3)*0.2),round(scrsz(4)*0.2)];
hfig=figure('Numbertitle','off',...
'Name','Chargement',...
'OuterPosition',scrsz,'Toolbar','none',...
'Menubar','none','Color','k','Visible','on');
then I used the 'normalized' units to fix the position of each uicontrol inside the figure or any uicontrol like this:
a=uicontrol('Parent',hfig,'Units','Normalized','Position',[0.05 0.05 0.9 0.9],...
'Fontsize',12,'String',str);
How can I do such method in appdesigner with uifigure, and uicontrol to be sure that the container inside a uifigure will be resize when I changed the uifigure position

採用された回答

Mario Malic
Mario Malic 2021 年 1 月 14 日
Hi Christophe,
If you're using App Designer app, most of the content (if not all) in the uifigure will be resized when the uifigure is resized. when the option called "AutoResizeChildren" in Position tab is enabled. It exists on components like UIFigure, Group Tab, etc.
  3 件のコメント
I2M
I2M 2021 年 1 月 14 日
It is like if the uifigure is not the parent of the container
Mario Malic
Mario Malic 2021 年 1 月 14 日
編集済み: Mario Malic 2021 年 1 月 14 日
Can you try changing properties using the dot-notation?
app.UIFigure.Position = [0.05 0.05 0.9 0.9];
% Replace UIFigure with the name of your component
If you're interested to start your app in maximised mode, there's an option for that in UIFigure component - Window Apperance - Window State.

サインインしてコメントする。

その他の回答 (1 件)

I2M
I2M 2021 年 1 月 14 日
It is what I have already done
scrsz = get(0,'ScreenSize');
scrsz=[scrsz(1)+0.1*scrsz(3),scrsz(2)+0.1*scrsz(4),round(scrsz(3)*0.8),round(scrsz(4)*0.8)];
app.UIFigure.Position=scrsz;
  2 件のコメント
I2M
I2M 2021 年 1 月 14 日
It seems that one way to tdo that is to use the grid layout container inside the figure
Mario Malic
Mario Malic 2021 年 1 月 14 日
It's best if you post your comment as an answer and accept it instead of my answer.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDevelop uifigure-Based Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by