MATLAB Answers

M. A.
1

Type "@" in UI edit field without closing Matlab on a German keyboard

Asked by M. A.
on 8 May 2017
Latest activity Answered by M. A.
on 7 Jun 2017
Problem: Whenever I want to write the "@" sign in an edit box (uicontrol('Style','edit')) in my Matlab GUI figure, Matlab closes.
The reason is probably that in order to type an "@" sign I have to press AltGr+Q, which is the same as Ctrl+Alt+Q (German keyboard layout). The shortcut to close Matlab is Ctrl+Q. This explains the problem, but then I don't know how to input an "@" sign whithout having to rely on tricks like using the Windows Character Map utility or switching to another keyboard language as this GUI is intended to be used by other people beside me. Any suggestions? Can I disable the Ctrl+Q shortcut in my GUI as a workaround?
I use Matlab R2016b on Win7 Enterprise 64bit, German keyboard layout (QWERTZ).

  2 Comments

I do not have such problems with a German keyboard, Win7/64, Matlab 2009a. I will test this with 2016b in the evening. While my Matlab closes at Ctrl-Q also, Ctrl-Alt-Q creates the @, in the uicontrol and in the command window.
[EDITED] Confirmed. In R2016b typing AltGr-Q in an edit-uicontrol quits Matlab. Cruel.

Sign in to comment.

2 Answers

Answer by M. A.
on 7 Jun 2017
 Accepted Answer

I filed a Service Request with Mathworks. They confirmed the issue and provided a workaround which I'd like to share here:
The figure window forwards CTRL+Q to the command window which triggers the closing operation. As a workaround, you can set the preference in MATLAB to "Confirm before exiting MATLAB". Go to preference Under General > Confirmation Dialogs Select "Confirm before exiting MATLAB" Typing "@" first time in a new figure window will trigger the confirmation. Once you hit cancel and proceed to type "@" again MATLAB won't quit. Alternatively, try clicking on the File menu to trigger population of submenus. After that, Ctrl+Q no longer quits MATLAB."
Both workarounds worked in my case.

  0 Comments

Sign in to comment.


Answer by Jan
on 8 May 2017

Confirmed: R2016b Win7/64 is closed, when you hit AltGr-Q to get an @ character in an edit-uicontrol.
uicontrol('Style', 'edit')
Using a WindowKeyPressFcn in the figure does not help.
I've removed the keyboard shortcut Ctrl-Q in the preferences and then Matlab is not closed anymore, when Ctrl-Q is pressed in the command window. But AltGr-Q still quits Matlab when pressed in a uicontrol. Ugly.

  0 Comments

Sign in to comment.