The documentation on Handle Graphics Object Properties under Uicontrol has the following description for the Callback property:
To execute the callback routine for an editable text control, type in the desired text, then either:
- Move the focus off the object (click the mouse someplace else in the GUI),
- For a single line editable text box, press Return, or
- For a multiline editable text box, press Ctl-Return.
However, I try the following code:
uicontrol('Style','edit',... 'units','characters',... 'callback','disp(''Edit Box Callback'')',... 'position',[10 10 50 2])u(1) = uimenu('parent',gcf,... 'Label','top Level')u(2) = uimenu('parent',u(1),... 'Label','First Item');u(3) = uimenu('parent',u(1),... 'Label','Second Item',... 'callback','disp(''Menu Callback'')');
Now I type in the edit field and then click the second menu item. The callback of the menu executes but up to this point the callback for the edit box has not executed.
Best Answer