Command window is active but not in the foreground?

3 views (last 30 days)
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 8.1.0.604 (R2013a)
Thanks, Sascha

Answers (1)

Jan
Jan on 22 May 2013
Edited: Jan on 23 May 2013
This sounds like a bug. Perhaps this helps:
[EDITED 2]
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.
  10 Comments
Sascha
Sascha on 11 Jul 2013
the normal "clock" output is displayed then.
Jan
Jan on 11 Jul 2013
Then this means, that the WindowGainedFocusCallback callback is called regularily, but com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame.toFront is damaged. Do you use the Java version shipped with Matlab or is the newest Java version used automatically like on Macs? I assume, that the Java call to bring the window to front is forwarded to a system call, such that an update of your window manager could be useful also. I could offer a system call, which bring windows to front under Windows, but I do not know how to do this under Linux.
But in any case I think that contacting the technical support might be useful, after you and me have tried all more or less obvious workarounds.

Sign in to comment.

Categories

Find more on Argument Definitions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!