From: kimura wataru<ki...@us...> - 2006-01-05 15:03:45
|
Hi, If the super class of your cell class confirms to protcol NSCoding (such as NSView), we can copy an object with NSArchiver/NSUnarchiver. data = OSX::NSArchiver.archivedDataWithRootObject(view) newview = OSX::NSUnarchiver.unarchiveObjectWithData(data) Sun, Jan 1, 2006 4:20:39 PM, Dave Howell wrote: >I'm trying to set up a Sudoku number puzzle solving tool, which >involves (in part) having a nine by nine grid in a window. Each cell of >this grid contains the digits 1 through 9 in a 3x3 array. > >I have this window, and one cell, in a separate NIB file from the >MainMenu file. So I can use code like this to open that window and >instantiate the contents: > > mainWindow = SudokuWindow.alloc.init.createWindow > > (createWindow is a method I created in SudokuWindow for working on the >window, since :window isn't defined when the init code runs) > >So far so good. Now, I need 80 more cells like the one already in the >NIB file, but trying to create them "by hand" seems more than a little >crazy. The nine digits are represented as an NSMatrix of NSButtonCells, >and the NSMatrix is linked to > >class SuCell < OSX::NSObject > blah blah blah >end > -- kimura wataru |