Path: news.mathworks.com!newsfeed-00.mathworks.com!news.kjsl.com!newsfeed.stanford.edu!newsfeed.news.ucla.edu!nrc-news.nrc.ca!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: Axes tools in GUI
Date: Tue, 1 Jul 2008 19:49:29 +0000 (UTC)
Organization: National Research Council Canada - Conseil national de rechereches Canada
Lines: 29
Message-ID: <g4e1o9$apk$1@canopus.cc.umanitoba.ca>
References: <g414n2$no7$1@fred.mathworks.com> <g4dmdi$a0u$1@fred.mathworks.com> <g4dmtv$h8f$1@fred.mathworks.com> <g4dp9g$l9p$1@fred.mathworks.com>
NNTP-Posting-Host: origin.ibd.nrc.ca
X-Trace: canopus.cc.umanitoba.ca 1214941769 11060 192.70.172.160 (1 Jul 2008 19:49:29 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Tue, 1 Jul 2008 19:49:29 +0000 (UTC)
Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Xref: news.mathworks.com comp.soft-sys.matlab:476962



In article <g4dp9g$l9p$1@fred.mathworks.com>,
David  <daviddoria@gmail.com> wrote:

>To set the ButtonDownFcn of the object itself, what do I do?
>%my_plot_function.m
>p = imshow(stuff);
>set(p,'ButtonDownFcn', @GetClick(p.CurrentPoint) )

>where
>GetClick.m is simply

>function GetClick(MyPoint)
>disp(MyPoint)

>It says first "Invalid syntax" on the ( before
>p.CurrentPoint.  It also says "Too many input arguments
>using GetClick".

set(p,'ButtonDownFcn', @GetClick);


function GetClick(src,evt)
  disp(get(src,'CurrentPoint'))
end


-- 
   "Beware of bugs in the above code; I have only proved it correct,
   not tried it."                                    -- Donald Knuth