[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Pointing at a window.
- To: info-macl@cambridge.apple.com
- Subject: Pointing at a window.
- From: Kevin Gallagher <Gallagher@gilgamesh.cs.umass.edu>
- Date: Fri, 27 Apr 90 13:27:01 EDT
- Cc: Gallagher@gilgamesh.cs.umass.edu
- Reply-to: Gallagher@gilgamesh.cs.umass.edu
- Sender: Gallagher@Gilgamesh@cambridge.apple.com
I'd like to be able to choose (not select) a window by pointing at it
with the mouse. I'm using _GetMouse to get the location of the mouse
click and _FindWindow to then determine which window (if any) is under
the mouse. However, no matter where I click _FindWindow returns 0
(meaning on the desktop) and WHICH-WINDOW is not a pointer to a window.
The _GetMouse call seems to work fine, because the point I get back is
reasonable.
Can anybody tell me what I'm doing wrong?
(in-package 'user)
(require :records)
(require :traps)
(defun point-at-a-window ()
(ccl:%stack-block ((where 4))
(ccl:%put-word where 0 0)
(ccl:%put-word where 0 2)
(do () ((ccl:mouse-down-p) t))
(ccl:_GetMouse :long where)
(ccl:rlet ((which-window :window))
(let ((result (ccl:_FindWindow :long where :ptr which-window :word)))
(print-db (ccl:point-string (ccl:%get-long where))
result
(ccl:%ptr-to-int which-window)
(ccl:rref which-window :window.windowkind)
(ccl:pointerp which-window)
(ccl:zone-pointerp which-window)
(ccl:handlep which-window))))))
Next question: Is there any way to click in an unselected window without
causing that window to become the selected window? I have an
application that displays stuff in several windows. The user can
interact with the displayed stuff using the mouse to point at things,
mark regions, etc. However, there's no reason to ever make the window
clicked on be the selected window. It just causes confusion.
This is a problem with my point-at-a-window function above. Clicking
on the window to choose it, also selects it.
Thanks for your help,
Kevin Gallagher
Gallagher@cs.umass.edu