Thread Subject: Auto select editable text on tab in gui

Subject: Auto select editable text on tab in gui

From: Deepak

Date: 14 Jul, 2009 00:07:05

Message: 1 of 2

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? Basically in my GUI, each user input field has some default values. If the user wants to change these, he/she should simply be able to reach the field by pressing tab a few times, and then type in the new value. Right now, the user will have to first delete the original contents.

Any help will be highly appreciated.

Regards,
Deepak

Subject: Auto select editable text on tab in gui

From: Walter Roberson

Date: 14 Jul, 2009 19:46:33

Message: 2 of 2

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.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
gui Deepak 13 Jul, 2009 20:09:04
select text Deepak 13 Jul, 2009 20:09:04
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com