[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Color-window-mixin and global-to-local
- To: info-macl@cambridge.apple.com
- Subject: Color-window-mixin and global-to-local
- From: Richard Lynch <lynch@aristotle.ils.nwu.edu>
- Date: Wed, 24 Oct 90 15:41:59 CDT
Anybody have any idea why a color-window can't do global-to-local right?
Included is sample code to demonstrate this.
As near as I can tell, the problem is not the port changing, but in the
_GlobalToLocal trap call. (Comment out the _GetPort and _SetPort lines to
see this. [3 lines to comment out]).
As far as I can tell, the horizontal number of the incorrect answer changes
with each new window. The vertical component does not change (but is not
right).
Of course, now that I have figured out _GlobalToLocal trap call, I don't
need to worry about this much, but maybe it will be helpful to someone
else.
Here is the code:
(require 'quickdraw)
(require 'traps)
(oneof (list *color-window-mixin* *dialog*) ;This is the same as
*color-dialog* for those
;of you who may actually have
documentation
;that mentions this. Somewhere
between APDA
;and my bosses, the update docs
got shortened
;to one page that doesn't.
:window-title "FOOBAR color-window"
:window-position #@(200 100)
:dialog-items
(list
(oneof *button-dialog-item*
:dialog-item-text "Push Me"
:dialog-item-action
(nfunction dialog-item-action
(lambda ()
(declare (object-variable my-dialog wptr))
(%stack-block ((old-port-ptr 4)
(point-ptr 4)
)
(%put-long point-ptr #@(200 100))
(_GetPort :ptr old-port-ptr)
(_SetPort :ptr (ask my-dialog wptr))
(format t "Unless you move the window, both answers should be
(0 0)~%")
(format t "(global-to-local 200 100) -> ~A~%"
(point-string (ask my-dialog (global-to-local 200
100)))
)
(format t "(_GlobalToLocal 200 100) -> ~A~%"
(point-string
(progn
(_GlobalToLocal :ptr point-ptr)
(%get-long point-ptr)
) )
)
(_SetPort :ptr (%get-ptr old-port-ptr))
) ) ) ) ) )
P.S. Is (was) there a bug-macl or something and should this have gone
there instead/also?
Thanks in advance.
"TANSTAAFL" Rich lynch@aristotle.ils.nwu.edu