Peterは正しいです、didEndSelector:セレクターを期待しているので、次のようなことを試してください。
def bookmark_created
puts "Bookmark created"
end
def createBookmark(sender)
NSApp.beginSheet(bookmarkSheet,
modalForWindow:mainWindow,
modalDelegate:self,
didEndSelector:"bookmark_created:",
contextInfo:nil)
end
呼び出すメソッドの名前の後にコロンを追加したことに注目してください。また、MacRubyベータリリースのバグのようです。MacRubyトラッカーでバグを報告することをお勧めします:http://www.macruby.org/trac/newticket
Appleのドキュメントに示されている例を次に示します。
- (void)showCustomDialog: (NSWindow *)window
// User has asked to see the dialog. Display it.
{
if (!myCustomDialog)
[NSBundle loadNibNamed: @"MyCustomDialog" owner: self];
[NSApp beginSheet: myCustomDialog
modalForWindow: window
modalDelegate: nil
didEndSelector: nil
contextInfo: nil];
[NSApp runModalForWindow: myCustomDialog];
// Dialog is up here.
[NSApp endSheet: myCustomDialog];
[myCustomDialog orderOut: self];
}
ご覧のとおり、エンドセレクターをnilに設定できるはずです。それまでの間、私の回避策は問題なく機能します。
幸運を、