Path: news.mathworks.com!newsfeed-00.mathworks.com!solaris.cc.vt.edu!news.vt.edu!news.glorb.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe18.iad.POSTED!7564ea0f!not-for-mail
From: Walter Roberson <roberson@hushmail.com>
Organization: Canada Eat The Cookie Foundation
User-Agent: Thunderbird 2.0.0.22 (Windows/20090605)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Re: Auto select editable text on tab in gui
References: <h3gi79$otp$1@fred.mathworks.com>
In-Reply-To: <h3gi79$otp$1@fred.mathworks.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Lines: 13
Message-ID: <eg57m.37$nL7.5@newsfe18.iad>
NNTP-Posting-Host: 24.79.146.116
X-Complaints-To: internet.abuse@sjrb.ca
X-Trace: newsfe18.iad 1247600778 24.79.146.116 (Tue, 14 Jul 2009 19:46:18 UTC)
NNTP-Posting-Date: Tue, 14 Jul 2009 19:46:18 UTC
Date: Tue, 14 Jul 2009 14:46:33 -0500
Xref: news.mathworks.com comp.soft-sys.matlab:555462


Deepak wrote:
> Usually, in a GUI, when you press tab to go to a editable field, its contents are
> automatically selected, so that when you type something, the original contents get
> replaced by what you type. Apparently, Matlab GUIs do not do that by default.
> How can I do this?

-Possibly- someone has already contributed something like this to the Matlab File Exchange.
If not, then you will need to have a KeyPressFunction for the field that figures out
whether you just entered the field and if so then erases the previous contents. But
even that is probably not what you want: probably you would like it so that if the user
clicks somewhere in the field, then the original contents do not get removed (so that the
user could edit the field.) If you want to get into that kind of sophistication then you
will need to use java functions to manage the field.