Hi. Our version of matlab was recently updated in the institute, but I'm not sure, if this is related to my problem to be honest.
Before the update, typing something while a figure was the active window, brought the command window to the foreground & made it the active window to type in. Now, the command window is still the new active window, but remains in the background. So I have to alt-tab twice to see, what I write. Any solutions?
System is Linux mint, matlab version is 184.108.40.2064 (R2013a)
No products are associated with this question.
This sounds like a bug. Perhaps this helps:
Although com.mathworks.mde.desk.MLDesktop.getInstance has toFront method, the mainFrame is required:
mainFrame = com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame; set(mainFrame, 'WindowGainedFocusCallback', @(x,y) mainFrame.toFront);
The callback is executed in the base workspace, such that mainFrame must exist there also. This is nice for testing (if I found a new way to insert a bug in the code), but for a productive environment any user program will call clear all as far as the experiences in the forum show. So you need either the longer version:
set(com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame, ... 'WindowGainedFocusCallback', ... @(x,y) com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame.toFront);
or a dedicated function:
set(com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame, ... 'WindowGainedFocusCallback', @liftDesktop);
function liftDesktop(ObjectH, EventData) com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame.toFront;
Please try this again.
You can perform own experiments with:
desktop = com.mathworks.mde.desk.MLDesktop.getInstance; methods(desktop) mainFrame = desktop.getMainFrame; methods(mainFrame)
methods(..., '-full') shows details about the input arguments of the methods. Remember that these functions are not documented, but work since at least R2008a - except for your setup, where it obviously does not work directly. Therefore I recommend the version with the function and add exhaustive comments and a TRY CATCH error handling also.
Play games and win prizes!Learn more