From: Neil S. <ne...@ha...> - 2005-11-26 05:40:16
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Actually, now I'm having some trouble. It was actually working for me just fine when I was disabling an NSTextField, and changing the title of an NSButton at the start of a thread, then enabling the field and restoring the button title back at the end. It started crashing on me when I tried adding an NSProgressIndicator to spin during the processing, though. So, I took your hint and looked up what performSelector is, but it still crashes on me when I do this in my WindowController: def buttonClicked # Clear table data array Thread.new do self.performSelector('startupCheck') data loop do # Do stuff, and add to the table data array @table.noteNumberOfRowsChanged end self.performSelector('endCheck') end end def startupCheck @resultsSpinner.startAnimation_ @textField.setEnabled(false) @button.setTitle('Cancel') end def endCheck @resultsSpinner.stopAnimation_ @textField.setEnabled(true) @button.setTitle('Validate') end The app crashes for me on the stopAnimation_ call, but doesn't crash when I omit that call. So am I doing this wrong here? I'm learning Cocoa as I go here, never having used it before trying Ruby Cocoa. What would be the right way to call back to the main thread? thanks, P.S. I have the underscores added because I get a 'methodSignature is null' exception if I make the call without the underscore. - -- Neil Stevens - ne...@ha... 'A republic, if you can keep it.' -- Benjamin Franklin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Darwin) iD8DBQFDh/VAf7mnligQOmERAgo5AJ4iwJ4HyerriZbHiXZQrwZw+yvMAACbBqke u9Ol0ed7N9PpIKE8VjUCF5A= =uUhx -----END PGP SIGNATURE----- |