Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!news2.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe01.iad.POSTED!7564ea0f!not-for-mail
From: Walter Roberson <roberson@hushmail.com>
Organization: Canada Eat The Cookie Foundation
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Re: twelti
References: <gevlj8$fpq$1@fred.mathworks.com>
In-Reply-To: <gevlj8$fpq$1@fred.mathworks.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 32
Message-ID: <lhJQk.379$JW.62@newsfe01.iad>
NNTP-Posting-Host: 24.79.146.116
X-Complaints-To: internet.abuse@sjrb.ca
X-Trace: newsfe01.iad 1226006737 24.79.146.116 (Thu, 06 Nov 2008 21:25:37 UTC)
NNTP-Posting-Date: Thu, 06 Nov 2008 21:25:37 UTC
Date: Thu, 06 Nov 2008 15:26:10 -0600
Xref: news.mathworks.com comp.soft-sys.matlab:499382


Todd Welti wrote:
> I have a strange problem.  I have a gui, with an edit box, with some default text in it.
> The callback of the edit box executes when I click inside the box and then click
> outside the box, even though the text in the text box has not changed.

That behaviour is consistent with the documentation for the Callback property of
uicontrols:

>>> To execute the callback routine for an edit text control, type in the desired
>>> text and then do one of the following:
>>>
>>> Click another component, the menu bar, or the background of the GUI.
>>>
>>> For a single line editable text box, press Enter.
>>>
>>> For a multiline editable text box, press Ctl+Enter.

You activated the control, you typed in the desired new text (which
happened to be empty), and you clicked another component, the menu bar,
or the background of the GUI, so as documented, the Callback fired.

If it is presenting a problem, store the previous String value in the User
field of the edit control, and when the Callback fires, get() the User field
and compare it to the current String value, and if they are the same, return
without doing anything (and if they differ, remember to save the new String
into the User field.)

-- 
.signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?