[futurebasic] Re: toolbox function teGetHiliteRgn (thanks!)

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2000 : Group Archive : Group : All Groups

From: "ronald b. kopelman" <rbkopelman@...>
Date: Tue, 27 Jun 2000 11:07:06 -0400
on 6/27/00 5:00 AM, chris young wrote:

> I don't have or haven't read the documentation on this function. However, from
> the C headers, it appears it could be implemented as (in FB^3):
> 
> TOOLBOX FN TEGetHiliteRgn(Handle, Handle) = short `0x3F3C, 0x000F, 0xA83D
> 
> Not tested, but should work. The call is defined in C as:
> 
> EXTERN_API(OSErr)
> TEGetHiliteRgn (RgnHandle region, TEHandle hTE)
> THREEWORDINLINE(0x3F3C, )x000F, 0xA83D);
> 
> hth
> 
> Chris Young

Chris,

    Thanks for the help! I wrote up the following function:

LOCAL FN cursorOverTxt
dim teRec&, hiRgnH&, er%, cursorPos;4
teRec& = tehandle(_outputEF)
hiRgnH&=FN NEWRGN
er%=FN TEGetHiliteRgn(hiRgnH&, teRec&)
CALL GETMOUSE(cursorPos)
LONG IF fn PtInRgn(cursorPos,hiRgnH&)
CURSOR=_arrowCursor
XELSE
CURSOR=_iBeamCursor
END IF
END FN

which I call in the main event loop (there is probably a better way to do
this) like so:

DO
IF window(_efNum) = _outputEF then FN cursorOverTxt
HANDLEEVENTS
UNTIL gAbort%
END

All of this seems to work fine! If I try to include the line:
TOOLBOX FN TEGetHiliteRgn(Handle, Handle) = short `0x3F3C, 0x000F, 0xA83D
in the code, I get a redefinition error. If I code up a new file like so,

TOOLBOX FN TEGetHiliteRgn(Handle, Handle) = short `0x3F3C, 0x000F, 0xA83D
LOCAL FN tst
dim teRec&, hiRgnH&, er%, cursorPos;4
teRec& = tehandle(1)
er%=FN TEGetHiliteRgn(hiRgnH&, teRec&)
CALL GETMOUSE(cursorPos)
LONG IF fn PtInRgn(cursorPos,hiRgnH&)
beep
END IF
END FN = er%

I don't get the error! I figure that I get the error because Staz uses it in
his drag&drop filter which I have used in my original project! I can't
figure out what Staz does half the time, but I am glad he does it! Thanks a
bunch for all your help.

ronald b. kopelman
rbkopelman@...