Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: ButtonDownFcn help
Date: Mon, 29 Oct 2007 22:15:07 +0000 (UTC)
Organization: TACT Computer Systems Ltd
Lines: 28
Message-ID: <fg5m1b$a7g$1@fred.mathworks.com>
References: <fg555k$j2e$1@fred.mathworks.com> <fg55gj$omr$1@fred.mathworks.com> <fg56qc$f26$1@fred.mathworks.com> <fg5a7r$4he$1@canopus.cc.umanitoba.ca>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1193696107 10480 172.30.248.37 (29 Oct 2007 22:15:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 29 Oct 2007 22:15:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 642467
Xref: news.mathworks.com comp.soft-sys.matlab:435149



roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <fg5a7r$4he$1@canopus.cc.umanitoba.ca>...
> In article <fg56qc$f26$1@fred.mathworks.com>,
> Matt Fig <spamanon@yahoo.com> wrote:
> >OOps, upon a more careful reading of the properties,
> >ButtonDownFcn does what it is supposed to do.  I would still
> >like to either have a left click clear the string or
> >initialize the string in a highlighted state so that once
> >the user starts typing the default string disappears and the
> >new one replaces it, if anyone knows how to do this.
> 
> You will have to modify the Java properties for this.


...and here's how (note: undocumented/unsupported by MathWorks):

1. download my FindJObj from the File Exchange:
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=14317

2. run the following:
edt1=uicontrol('style','edit',...); %no need to set
ButtonDownFcn
jedt1=findjobj(edt1,'nomenu'); %get underlying java object
cbStr='set(gcbo,''text'','''');set(gcbo,''MouseClickedCallback'',[])';
set(jedt1,'MouseClickedCallback',cbStr);

Yair Altman
http://ymasoftware.com