No BSD License  

Highlights from
setfocus

4.2

4.2 | 10 ratings Rate this file 17 Downloads (last 30 days) File Size: 1.97 KB File ID: #1898

setfocus

by Martin Weber

 

27 Jun 2002 (Updated 26 Aug 2002)

Program to set focus to objects (edit etc) without clicking with the mouse on them.

| Watch this File

File Information
Description

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.

Acknowledgements
This submission has inspired the following:
clickfocus, jMouseEmu: Mouse Emulator (v2.2)
MATLAB release MATLAB 6.1 (R12.1)
Other requirements Windows
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (11)
24 Dec 2002 Yaron Keren

Solved the problem. When will this be available in MATLAB itself?

01 Aug 2003 David Abraham

Great! Does the job, MATLAB should have a focus property settable in GUIDE!

24 Mar 2004 Brett Shoelson

Very useful...thanks, Martin!

19 May 2004 Stefan Bleeck

works :-)

29 Mar 2005 JTB .

I have incorporated your mouseclick.dll file into my matlab program and find it extremely useful! thank you!

05 Sep 2005 Ralph Schleicher

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.

21 Apr 2006 Anthony Beaucamp

You can replace the MouseClick DLL with the following 2 lines in Matlab:
    Input = java.awt.Robot;
    Input.mousePress(16);

23 Feb 2007 Jo Bergs

@ Anthony:
it took some time but actually i found
out that this only works with an small pause
before
mousePress(16) + mouseRelease(16)
at my system(linux);
but then its fine and
platform-independant(i guess).
Thanks for the hint.

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.

10 Jul 2008 Tom N

Martin provides a very nice workaround. Exactly what I needed. Thanks man!

11 Jul 2010 James Rao

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

Please login to add a comment or rating.
Updates
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

Tag Activity for this File
Tag Applied By Date/Time
gui tools Martin Weber 22 Oct 2008 06:46:04
example Martin Weber 22 Oct 2008 06:46:04
set focus Martin Weber 22 Oct 2008 06:46:04
setfocus Martin Weber 22 Oct 2008 06:46:04
utilities Martin Weber 22 Oct 2008 06:46:04
gui Martin Weber 22 Oct 2008 06:46:04
object Martin Weber 22 Oct 2008 06:46:04
set focus Hanyu Ye 05 Jan 2009 09:52:13

Contact us at files@mathworks.com