R2014b uipanel not showing on figure.

4 ビュー (過去 30 日間)
Stephen Bartel
Stephen Bartel 2019 年 7 月 30 日
コメント済み: Stephen Bartel 2019 年 7 月 30 日
My uipanel is not showing up on the figure no matter what I do. I have no idea what I am doing wrong. I tried googling without success.
ComponentHeight = 60;
GUIheight = 13 * ComponentHeight;
SettingsPanelWidth = 1000;
SettingsPanelHeight = 500;
SettingsPanelPosition = [AlarmGatePosition(1), AlarmGatePosition(2)-50-SettingsPanelHeight, SettingsPanelWidth, SettingsPanelHeight];
f = figure('Name', 'AlarmGate Settings', ...
'NumberTitle', 'off', ...
'Color', 'w',...
'Units', 'pixels',...
'ToolBar', 'none',...
'HandleVisibility', 'on',...
'Position', SettingsPanelPosition,...
'Resize', 'off',...
'Tag', 'AlarmGateSettings',...
'MenuBar', 'none');
infoPanelPosition = [50, SettingsPanelHeight*0.5, SettingsPanelWidth*0.6, SettingsPanelHeight*.45];
infoPanel = uipanel('Parent', f,...
'Title', 'Recipients',...
'TitlePosition', 'lefttop',...
'Tag', 'infoPanel',...
'Position', infoPanelPosition,...
'Units','pixels',...
'BackgroundColor','blue',...
'FontSize', 12,...
'Visible', 'on',...
'HandleVisibility', 'on'...
);
uistack(infoPanel, 'top')
  2 件のコメント
Jan
Jan 2019 年 7 月 30 日
What ois the value of AlarmGatePosition?
Stephen Bartel
Stephen Bartel 2019 年 7 月 30 日
編集済み: Stephen Bartel 2019 年 7 月 30 日
Thank you for assisting me with this issue. These are the values in the vector:
The figure has no issue showing, it is just the panel that does not show up within the figure.
Note I also tried assigning a CreateFcn function to the figure, in which CreateFcn has the uipanel being created and assigned to hObject (figure). This did not resolve the issue.
AlarmGatePosition =
20 910 240 120

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

採用された回答

Adam
Adam 2019 年 7 月 30 日
編集済み: Adam 2019 年 7 月 30 日
You need to define Units ahead of Position else the Position will be interpreted in default units (which are 'normalized') before the Units then get set to Pixels:
infoPanel = uipanel('Parent', f,...
'Title', 'Recipients',...
'TitlePosition', 'lefttop',...
'Tag', 'infoPanel',...
'Units','pixels',...
'Position', infoPanelPosition,...
'BackgroundColor','blue',...
'FontSize', 12,...
'Visible', 'on',...
'HandleVisibility', 'on'...
);
  3 件のコメント
Adam
Adam 2019 年 7 月 30 日
編集済み: Adam 2019 年 7 月 30 日
Yeah, I think that is true in many cases - e.g. it is a well known way of setting min, max, value properties on a slider rather than sequentially to avoid warning messages about it not being able to render because 'Value' is outside of the range of 'Min' to 'Max' etc.
I just had a vague recollection of having run into similar problems in the past when it came to units and positions. It feels like a bug, but it is probably considered a feature! I tested it in R2019a so its behaviour is the same as you are seeing in R2014b
Stephen Bartel
Stephen Bartel 2019 年 7 月 30 日
Since they haven't corrected it, I guess it is indeed a feature! Either way, thank you for bringing this to my attention.
Thanks
Stephen

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by