[Openmcl-devel] Weird problem with sheet return code
Ron Garret
ron at flownet.com
Tue Feb 9 18:28:44 PST 2010
I'm trying to display a window sheet using something like the following code:
(setf alert (make-instance 'ns:ns-alert))
(#/setMessageText: alert #@"Foo!")
(#/addButtonWithTitle: alert #@"Baz")
(#/addButtonWithTitle: alert #@"Bar")
(#/addItem: GUI::*TEXT-VIEW-CONTEXT-MENU* (#/separatorItem ns:ns-menu-item))
(#/addItemWithTitle:action:keyEquivalent:
GUI::*TEXT-VIEW-CONTEXT-MENU* #@"Foo" (objc:@selector #/foo:) #@"")
(objc:defmethod #/alertDidEnd:returnCode:contextInfo:
((self gui::hemlock-frame) return-code context-info)
(print return-code (HEMLOCK-EXT:TOP-LISTENER-OUTPUT-STREAM))
(%null-ptr))
(objc:defmethod (#/foo: :void) ((self gui::hemlock-text-view) sender)
(declare (ignore sender))
(let ((w (slot-value (slot-value self 'gui::pane) 'ns:_window)))
(#/beginSheetModalForWindow:modalDelegate:didEndSelector:contextInfo:
alert w w (objc:@selector #/alertDidEnd:returnCode:contextInfo:) (%null-ptr))))
This works, except for one thing: the value passed as the returnCode argument to alertDidEnd:returnCode:contextInfo: is the alert object, not as the Cocoa docs say, an integer indicating which button the user pressed. What am I doing wrong?
Thanks,
rg
More information about the Openmcl-devel
mailing list