Path: news.mathworks.com!not-for-mail
From: "Kenneth Eaton" <Kenneth.dot.Eaton@cchmc.dot.org>
Newsgroups: comp.soft-sys.matlab
Subject: Re: ButtonDownFcn Callback for Axes Objects
Date: Tue, 2 Dec 2008 01:55:03 +0000 (UTC)
Organization: Cincinnati Children's Hospital Research Center
Lines: 10
Message-ID: <gh24hn$2hg$1@fred.mathworks.com>
References: <ggg9ng$c4m$1@fred.mathworks.com> <gghamu$oe5$1@fred.mathworks.com> <ggi6ji$n95$1@fred.mathworks.com> <ggjpbb$c5d$1@fred.mathworks.com>
Reply-To: "Kenneth Eaton" <Kenneth.dot.Eaton@cchmc.dot.org>
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 1228182903 2608 172.30.248.35 (2 Dec 2008 01:55:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 2 Dec 2008 01:55:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1165924
Xref: news.mathworks.com comp.soft-sys.matlab:504281


"Thiago " <thiago@mathworks.com> wrote in message <ggjpbb$c5d$1@fred.mathworks.com>...
> To make it clear, this is just about replacing buttons by graphics (while retaining the callback capability). It's because of the fact that every GUI may change appearance once you test it in different systems. If anyone knows how to do it, please let me know.

Thiago,

I'm not totally sure of what you want, but it may be like what I did for rotating the camera in a game I posted to the FEX ("Staker"). The idea was this... I designed the WindowButtonDownFcn to look for clicks in the figure. I didn't use the ButtonDownFcn of the axes since the axes was actually not visible (and I don't remember it working in that case). It then checked the position of the mouse click relative to the position of the axes to see if it was inside it, and if so it took the appropriate action (left click = rotate, right click = pan, middle click = zoom). It could be expanded to work with multiple axes in the same figure if you needed it to. You can peek into the code for the game (although it is long) and in particular check out a couple key functions. I believe "mouse_game" may be one of them, but I don't remember offhand the naming convention I had for that older version since I've been working on a newer one.

If this sounds like the sort of behavior you want, check it out and I can give you more info about it as needed.

Ken