How to keep menu open when selecting option

I want to use the Menu Bar in Matlab App Designer as a Prefrence Tab, where multiple options can be checked/unchecked without closing the menu.
The default callback seems to always close the Menu when selecting any option.
f = uifigure();
supM = uimenu(f,'Text', 'SuperMenu 1');
subM_1 = uimenu(supM, 'Text', 'SubMenu 1'); % Option 1
subM_2 = uimenu(supM, 'Text', 'SubMenu 2'); % Option 2
Now i know how to toggle the checked option of the uimenu elements on 'Selecting' the respective element, but I do not know of any method to keep the SupMenu open when selecting one of the SubMenu elements.

 採用された回答

Adam Danz
Adam Danz 2021 年 11 月 17 日

1 投票

I have also found this default beahvior frustrating but I do not know a way to keep the menu open after making a selection. I suggest submitting an enhancement request to tech supporting using the link below.

4 件のコメント

Jonas Steiner
Jonas Steiner 2021 年 11 月 18 日
Thanks for the reply,
i was trying to do a work around for quite a while and it is a relief that i am not the only struggeling at that!
I followed your suggestion!
Adam Danz
Adam Danz 2021 年 11 月 18 日
I've also voiced my opinion on this so the more voices, the better. I'd be interested if you learn of a workaround.
Jonas Steiner
Jonas Steiner 2021 年 11 月 19 日
編集済み: Jonas Steiner 2021 年 11 月 19 日
I've put a tree (check box) along with a 'submit' button inside a panel and turned the visibility off initially. When slecting the sup-Menu the visibility is turned on and multiple selections can be made.
I also move it into and out of the frame which was required to avoid the panel messing up the layout in another app i am working on!
edit: using a radio button group might be a better solution for this kind of approach
Adam Danz
Adam Danz 2021 年 11 月 19 日
Creative workaround. I suppose the only reason to move the checkbox is to not see it in Design View within AppDesigner.
You may want to look into using tabs

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

製品

リリース

R2021b

質問済み:

2021 年 11 月 17 日

コメント済み:

2021 年 11 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by