dp1g+@andrew.cmu.edu (Demetri Patukas) (11/26/88)
Why doesn't ReportMouse() work for me?
I have a window, I have an IDCMP. I would like to recieve MOUSEMOVE
messages only when the left button is down, so I thought I would watch
for MOUSEBUTTON messages and call ReportMouse(window,TRUE) when I get
a class==SELECTDOWN, and ReportMouse(window,FALSE) when I get a
class==SELECTUP. Well, I am having problems with ReportMouse().
When I call ReportMouse(window,FALSE), nothing happens (I continue to
recieve MOUSEMOVEs), and when I call ReportMouse(window,TRUE), I get a
big ol' guru! This happens no matter where in my program I call it.
I thought I might achieve the same thing instead by using ModifyIDCMP,
and changing MOUSEMOVE when I get the appropriate MOUSEBUTTONs (though
I don't like this approach as much). Well, whenever I call
ModifyIDCMP(window, anyflags), I lose MOUSEMOVEs totally. Even if
MOUSEMOVEs are on and I request that they stay on. Can anyone tell me
what's wrong? Is there something conceptually wrong with this? Or am
I just missing some detail?
More Info:
"window" is a pointer to a struct window as returned from OpenWindow.
My window is a backdrop window, but I have tried it on a normal window too.
I am reading messages off of window->UserPort.
And here's a small piece of code (from my event loop):
if (class & MOUSEBUTTONS) {
if (code & SELECTDOWN) ModifyIDCMP(window,MOUSEMOVE | IDCMPflags);
if (code & SELECTUP) ModifyIDCMP(window,IDCMPflags);
-or-
if (class & MOUSEBUTTONS) {
if (code & SELECTDOWN) ReportMouse(window,TRUE);
if (code & SELECTUP) ReportMouse(window,FALSE);
(please cc: me a copy of replies, I'll get it quicker than wading
through posts) --demetri <dp1g@andrew.cmu.edu>ali@polya.Stanford.EDU (Ali T. Ozer) (11/27/88)
In article <0XXZpjy00WB68VnEMd@andrew.cmu.edu> Demetri Patukas writes: > Well, I am having problems with ReportMouse(). If you are using Manx, try calling ReportMouse (TRUE, window). I seem to remember hearing about some such bizarrity with the Manx ReportMouse(), and, just taking a look at several of my programs that do work fine, I see that I call ReportMouse (boolean, win) instead of the advertised ReportMouse (win, boolean). Ali Ozer
dp1g+@andrew.cmu.edu (Demetri Patukas) (11/27/88)
Thanks for quick replies from <aozer@NeXT.com> and
<riley@tcgould.tn.cornell.edu> about my ReportMouse problems.
*** solution to problem#1: It seems that, contrary to the
documentation, the arguments are reversed (that is,
ReportMouse(FLAG,window)). This works.
My other problem (with ModifyIDCMP) turned out to be that I was
checking for flag bits on the Code field, and this is apparently a
no-no (you should just check for straight values). As it turns out,
(SELECTDOWN & SELECTUP)==SELECTDOWN, so I always fell through and
turned off mouse events.
*** solution to problem #2: ModifyIDCMP does work as advertised. My
problem was that I used & (ampersand) to check the Code field of a
MOUSEBUTTONS message, but I should have used ==.
Thanks again,
demetri <dp1g@andrew.cmu.edu>