Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#525 closed defect (invalid)

32-bit GUI acceptsFirstReponder bug

Reported by: rongarret Owned by:
Priority: normal Milestone:
Component: IDE Version: trunk
Keywords: Cc:

Description

Trying to get an ns-window to accept mouse events by defining an accepts-first-responder method that returns T works in 64-bit CCL but not 32-bit. In 32-bit, clicking on the window produces the following error (in the altconsole):

Error: value T is not of the expected type (UNSIGNED-BYTE 32).

While executing: (:INTERNAL[Nsview acceptsFirstResponder]|), in process Initial(0).

Type :POP to abort, :R for a list of available restarts. Type :? for other options.

1 >

Code to reproduce follows. Run the code, then click on the resulting window.

(defun nsstr (s) (make-instance 'gui::ns-lisp-string :string s))

(defun make-ns-window (x y &optional (title "Untitled"))

(let ((nsw (make-instance 'ns:ns-window

:with-content-rect (ns:make-ns-rect 0 0 x y) :style-mask 15 :backing #$NSBackingStoreBuffered :defer t)))

(#/setTitle: nsw (nsstr title)) (#/setReleasedWhenClosed: nsw nil) (#/center nsw) (#/orderFront: nsw nil) nsw))

(defclass nsview (ns:ns-view)

(container) (:metaclass ns:+ns-object))

(ccl::define-objc-method ((:boolean accepts-first-responder) nsview) t)

(setf w (make-ns-window 300 300)) (#/setContentView w (make-instance 'nsview))

Change History (2)

comment:1 in reply to: ↑ description Changed 10 years ago by rongarret

  • Resolution set to invalid
  • Status changed from new to closed

Replying to rongarret:

Doh! Never mind. Need to use #$YES instead of T.

Odd that using T works in the 64-bit version. This is not something that I would have expected to diverge between the two versions.

comment:2 Changed 10 years ago by gb

The ObjC foreign type that denotes boolean variables is #>BOOL (or :<BOOL>), not :boolean.

To get a window to accept mouse-moved events, call

(#/setAcceptsMouseMovedEvents: w t)

Accepting (or refusing to accept) "first responder" status is different.

Note: See TracTickets for help on using tickets.