[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Color-window-mixin and global-to-local

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
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

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
                                            ;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)
    (oneof *button-dialog-item*
      :dialog-item-text "Push Me"
      (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
            (format t "(_GlobalToLocal 200 100) -> ~A~%"
                          (_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