Set focus to objects. When starting a Matlab GUI it is normally not possible to activate the cursor in an edit object. Before you can type, you'll have to click with the mouse in the edit field. With setfocus it is possible to activate the cursor with program code by passing the object handle to setfocus. setfocus simply simulate a mouseclick in the area of the object.
Martin, I really like your solution to this problem. I was wondering if you have the source to mouseclick, to recompile it into a mex32 file since dll support is being phased out
10 Jul 2008
Martin provides a very nice workaround. Exactly what I needed. Thanks man!
04 Oct 2007
Marc O Donnagain
is this the same as uicontrol(handle)? I tried using this function before trying uicontrol which did what I wanted.
23 Feb 2007
it took some time but actually i found
out that this only works with an small pause
mousePress(16) + mouseRelease(16)
at my system(linux);
but then its fine and
Thanks for the hint.
21 Apr 2006
You can replace the MouseClick DLL with the following 2 lines in Matlab:
Input = java.awt.Robot;
05 Sep 2005
The setfocus command does not handle all failure cases. There is no source code for the mouseclick command. It does not work on Unix. Ask me for an improved version solving all issues.
29 Mar 2005
I have incorporated your mouseclick.dll file into my matlab program and find it extremely useful! thank you!
19 May 2004
24 Mar 2004
Very useful...thanks, Martin!
01 Aug 2003
Great! Does the job, MATLAB should have a focus property settable in GUIDE!
24 Dec 2002
Solved the problem. When will this be available in MATLAB itself?
06 Aug 2002
I noticed an error in my source file. (Typed a instead of h, line 29)
23 Aug 2002
Inserted a drawnow after deleting the callback to update the figure data