[comp.sys.amiga.programmer] Questions about dealing with the mouse.

kenh@ersys.edmonton.ab.ca (Ken Huisman) (06/07/91)

I am having a couple problems with a few things.  Here are my
questions:
what does the ReportMouse() function do?
Using Aztec C 5.0e I get an undefined symbol error when it
comes to the ReportMouse() function.  Which library is it supposed
to be in?  I am including ml.lib, cl.lib and even sl.lib, and I
still get the error.
 
What I am trying to do is allow my program to highlight an area of
the screen by pressing the mouse button, dragging, and releasing
(this is a common operation done in many programs).  As it stands, I
get an IDCMP message when I press the mouse button, and when I release
the mouse button, but I don't get any when I move the mouse around.
I have put the MOUSEMOVE, REPORTMOUSE, and MOUSEBUTTONS flags in my
newwindow structure, but I only get MOUSEMOVE messages when I drag
one of the sliders around.  I want mousemove messages during my
highlighting process, after I have pressed the mouse button down and
not after I have released it.  Will the ReportMouse() function help?
(I really don't know what it does, I was just going to try and see).
 
Is there another method I can use?  Any help on either question
would be much appreciated.
 
Ken
 
ersys!kenh@nro.cs.athabascau.ca or kenh@ersys.edmonton.ab.ca

Ken Huisman              kenh@ersys.edmonton.ab.ca
Edmonton Remote Systems:  Serving Northern Alberta since 1982

ken@cbmvax.commodore.com (Ken Farinsky - CATS) (06/07/91)

In article <yXk633w164w@ersys.edmonton.ab.ca> kenh@ersys.edmonton.ab.ca (Ken Huisman) writes:
>what does the ReportMouse() function do?

ReportMouse() turns mouse move events on or off for a window.
You will get lots of mouse events while they are turned on, so
process them very quickly.  The program will only see them if
it has MOUSEMOVE set in the IDCMP.

Also, from the ReportMouse() autodoc:

	Also, it is still endorsed to simply set the WFLG_REPORTMOUSE flag bit
	in Window->Flags, or reset it, on your own.  Make the operation
	an atomic assembly instruction (OR.W #WFLG_REPORTMOUSE,wd_Flags+2(A0)
	where A0 contains your window pointer).  Most compilers will produce
	an atomic operation when faced with:
		Window->Flags |= WFLG_REPORTMOUSE;
		Window->Flags &=~WFLG_REPORTMOUSE;
	(NOTE:  In V36, WFLG_REPORTMOUSE equals the old REPORTMOUSE.)

>Using Aztec C 5.0e I get an undefined symbol error when it...

don't know.

>What I am trying to do is allow my program to highlight an area of
>the screen by pressing the mouse button, dragging, and releasing
>(this is a common operation done in many programs)...

Two suggestions:

	1.  Use the FOLLOWMOUSE flag on a large gadget in the select area.
	This will let the program only hear mouse messages when the user
	drags the mouse after picking something in the select area.

	2.  Use INTUITICKS to do the same thing.  If using INTUITICKS, wait
	for the gadget/mouse down event, update the display on each tick until
	the gadget/mouse up event is received.  Update all of the information
	after the gadget/mouse up event.
-- 
Ken Farinsky - CATS - Commodore Business Machines