Path: news.mathworks.com!not-for-mail
From: "Todd Welti" <twelti@harman.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: twelti
Date: Thu, 6 Nov 2008 22:11:02 +0000 (UTC)
Organization: Harman Industries International
Lines: 41
Message-ID: <gevq1m$g81$1@fred.mathworks.com>
References: <gevlj8$fpq$1@fred.mathworks.com> <lhJQk.379$JW.62@newsfe01.iad>
Reply-To: "Todd Welti" <twelti@harman.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1226009462 16641 172.30.248.35 (6 Nov 2008 22:11:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 6 Nov 2008 22:11:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 57524
Xref: news.mathworks.com comp.soft-sys.matlab:499399


Walter Roberson <roberson@hushmail.com> wrote in message <lhJQk.379$JW.62@newsfe01.iad>...
> 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)?

I thought I was clear, the text in the box did not change, I simply clicked in the box, then outside it.

According to the documentation:

Triggering Callback Execution

If the contents of the edit text component have been changed, clicking inside the GUI but outside the edit text causes the edit text callback to execute. The user can also press Enter for an edit text that allows only a single line of text, or Ctrl+Enter for an edit text that allows multiple lines.