Path: news.mathworks.com!newsfeed-00.mathworks.com!newscon02.news.prodigy.net!prodigy.net!news.glorb.com!news.aset.psu.edu!news.cse.psu.edu!elk.ncren.net!newsflash.concordia.ca!canopus.cc.umanitoba.ca!not-for-mail
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Newsgroups: comp.soft-sys.matlab
Subject: Re: ButtonDownFcn help
Date: Mon, 29 Oct 2007 22:26:50 +0000 (UTC)
Organization: National Research Council Canada - Conseil national de rechereches Canada
Lines: 36
Message-ID: <fg5mna$j3d$1@canopus.cc.umanitoba.ca>
References: <fg555k$j2e$1@fred.mathworks.com> <fg56qc$f26$1@fred.mathworks.com> <fg5a7r$4he$1@canopus.cc.umanitoba.ca> <fg5m1b$a7g$1@fred.mathworks.com>
NNTP-Posting-Host: origin.ibd.nrc.ca
X-Trace: canopus.cc.umanitoba.ca 1193696810 19565 192.70.172.160 (29 Oct 2007 22:26:50 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Mon, 29 Oct 2007 22:26:50 +0000 (UTC)
Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Xref: news.mathworks.com comp.soft-sys.matlab:435151



In article <fg5m1b$a7g$1@fred.mathworks.com>,
Yair Altman <altmanyDEL@gmailDEL.comDEL> wrote:
>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:
>> >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.

>...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);

Hmmm, that appears to me to clear the mouse click callback after
clearing the edit field. If so, then the callback would somehow
have to be reprimed after the field lost focus. Matt wasn't clear
on what he would like to have happen after the first time; my own
interpretation is that he wanted mouse left-click to clear the
string each time. Which leads to difficulty if the user wants to
use the mouse to reposition within the string for editting purposes.

Matt? What do you expect after the first firing?
-- 
   "Beware of bugs in the above code; I have only proved it correct,
   not tried it."                                    -- Donald Knuth