uimenu mouse-over behavior .

2 Ansichten (letzte 30 Tage)
zohar
zohar am 5 Apr. 2016
Beantwortet: TED MOSBY am 21 Aug. 2025
Hi all, I have a uimenu with a lot sub-menu. When I am moving the mouse over on each menu the sub-menu pop up. And if my hand is shaking it very annoying.
f = figure('MenuBar','None');
test = uimenu(f,'Label','test');
test1 = uimenu(test,'Label','test1','Callback','disp(''test1'')');
test2 = uimenu(test,'Label','test2','Callback','disp(''test2'')');
test3 = uimenu(test,'Label','test3','Callback','disp(''test3'')');
test4 = uimenu(test,'Label','test4','Callback','disp(''test4'')');
test11 = uimenu(test1,'Label','test11','Callback','disp(''test11'')');
test12 = uimenu(test1,'Label','test12','Callback','disp(''test12'')');
test13 = uimenu(test1,'Label','test13','Callback','disp(''test13'')');
test21 = uimenu(test2,'Label','test21','Callback','disp(''test21'')');
test22 = uimenu(test2,'Label','test22','Callback','disp(''test22'')');
test23 = uimenu(test2,'Label','test23','Callback','disp(''test23'')');
test31 = uimenu(test3,'Label','test31','Callback','disp(''test31'')');
test32 = uimenu(test3,'Label','test32','Callback','disp(''test32'')');
test33 = uimenu(test3,'Label','test33','Callback','disp(''test33'')');
test41 = uimenu(test4,'Label','test41','Callback','disp(''test41'')');
test42 = uimenu(test4,'Label','test42','Callback','disp(''test42'')');
test43 = uimenu(test4,'Label','test43','Callback','disp(''test43'')');
it looks like this
Now when I moving my mouse over the menu list the sub-menu pop-up,I don't want this behavior. I want that only if hit on the menu the sub-menu will appear, although the mouse is over the next menu.
Thx
  2 Kommentare
zohar
zohar am 6 Apr. 2016
Thx Walter, I saw this discussion and this is same problem that I am dealing with.
NO solution. Any help

Melden Sie sich an, um zu kommentieren.

Antworten (1)

TED MOSBY
TED MOSBY am 21 Aug. 2025
Hi,
By default, MATLAB's uimenu does not provide built-in properties or callbacks to control mouse-over behavior directly. The submenu display on hover is part of the native UI behavior and cannot be modified using standard MATLAB functions. However, you can try an alternative workaround below:
Use custom UI components:
  • Instead of uimenu, you can design your own menu system using buttons or panels (uibutton, uipanel, etc.) and control their visibility and behavior manually.
  • This gives full control over when submenus appear (e.g., only on click).
  • A uibutton can act as the main menu.
  • A uipanel will contain submenu buttons and will be hidden by default.
  • Clicking the main menu toggles the visibility of the submenu panel.
Here is some documentation for reference:
Hope it helps!

Kategorien

Mehr zu App Building finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by