Path: news.uiowa.edu!news.physics.uiowa.edu!math.ohio-state.edu!jussieu.fr!univ-lille1.fr!ciril.fr!news.imag.fr!univ-lyon1.fr!imt950.imt-mrs.fr!news
From: Benjamin BERNARD <bernardb@aix.ensam.fr>
Newsgroups: comp.sys.apple2.programmer
Subject: Re: Did anyone see my I-beam cursor?
Date: 26 Mar 1996 22:58:28 GMT
Organization: Me against World
Lines: 54
Message-ID: <4j9sqk$e47@imt950.imt-mrs.fr>
References: <4j1uf1$fba@imt950.imt-mrs.fr> <4j5ss2$1pg@atlantis.atlantis.actrix.gen.nz>
NNTP-Posting-Host: cezanne.ensam-aix.fr
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 1.1N (X11; I; AIX 2)
X-URL: news:4j5ss2$1pg@atlantis.atlantis.actrix.gen.nz

dempson@atlantis.actrix.gen.nz (David Empson) wrote:

>Each time around the event loop, if nothing happened:
>
>If the mouse position has moved since last check then
>   Call FindWindow
>   If location is wInSysWindow then
>      do nothing (the NDA should deal with the cursor)
>      (you might want to remember the position, so you can fix the
>      cursor when it moves back out of the system window)
>   Else if location is wInContent AND window pointer is FrontWindow then
>      Call FindControl
>      If the returned part code is 130 then
>         (cursor is in text region of front window)
>         Set cursor to I-beam
>      Else
>         InitCursor
>   Else
>      InitCursor

I tried it:
{
MouseRec ZePos;
Word Ou_Ca;
GrafPortPtr *kellewin;
CtlRecHndl *zeCtlPtr;

ZePos=ReadMouse();
if ((ZePos.xPos!=OldPos.xPos)||(ZePos.yPos!=OldPos.yPos))
	{ Ou_Ca=FindWindow(kellewin,ZePos.xPos,ZePos.yPos);
	if (Ou_Ca!=wInSysWindow)
	    {if ((Ou_Ca==wInContent)&&(*kellewin==FrontWindow()))
		{if (FindControl(leCtlPtr,ZePos.xPos,ZePos.yPos,*kellewin)==130)
			{ /*Set IBeam...*/ }
		else InitCursor(); }
	else InitCursor;}
}

First impressions: it works!
Lasting impressions: it's really slow, and the cursor is flickering.

I tried to improve the first test ("mouse moved?) doing 

if (ZePos.mouseStatus&0x20)...

as bit 5 of mouseStatus is set if mouse moved since last read. It doesn't work.


Someone told me there was a flag bit that should switch automatically to the
IBeam cursor, but he doesn't know where.
Neither do I  :-(((((

status: waiting for infos, pliiiiiize.

