home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!munnari.oz.au!uniwa!cujo!ncrpda.curtin.edu.au!rocky.curtin.edu.au!user
- From: peter@cujo.curtin.edu.au (Peter N Lewis)
- Subject: Re: Detecting mouse position in a window ?
- Message-ID: <peter-130193090353@rocky.curtin.edu.au>
- Followup-To: comp.sys.mac.programmer
- Lines: 28
- Sender: news@ncrpda.curtin.edu.au
- Nntp-Posting-Host: ncrpda.curtin.edu.au
- Organization: NCRPDA, Curtin University
- References: <rudolph.726810080@unixg.ubc.ca> <1993Jan12.050224.14617@magnus.acs.ohio-state.edu>
- Date: Wed, 13 Jan 1993 01:05:03 GMT
-
- In article <1993Jan12.050224.14617@magnus.acs.ohio-state.edu>,
- jbush@magnus.acs.ohio-state.edu (J Eric Bush) wrote:
- >
- > In article <rudolph.726810080@unixg.ubc.ca> rudolph@unixg.ubc.ca
- > (Christopher E Rudolph) writes:
- >
- > >I obviously need to be checking where the mouse is at any one time and act
- > >appropriately. Does anyone have an example of how to do this gracefully.
- > >thanks, and sorry about it begin an FAQ
- >
- > Just use the GetMouse(p:point) procedure. If at first it gives you a global
- > point, then all you have to do it say point:=GlobalToLocal(p).
-
- Don't forget to SetPort to the window before using GlobalToLocal.
-
- Also, if you want to find out the mouse position in a background only app,
- you can use the event.where field from OSEventAvail (the most common reason
- for that is to detect when the mac is idle) (because GetMouse will crash if
- you haven't inited all the relevent managers).
-
- GetMouse(VAR_mouseLoc_Point);
- BOOLEAN:=OSEventAvail(mask_INTEGER,VAR_theEvent_EventRecord);
-
- Have fun,
- Peter.
-
- _______________________________________________________________________
- Peter N Lewis <peter@cujo.curtin.edu.au> Ph: +61 9 368 2055
-