On 30.01.2011, at 11:17, Andrew James wrote:
> I have a legacy builder class that creates a Carbon window and I want to 
> initialize an NSWindow with this WindowRef.

 What for? What are you trying to achieve? Nonestly, I wouldn't recommend 
mixing Carbon and Cocoa windows in the same application. There are many subtle 
and not-so-subtle bugs (from window ordering issues, e.g. on app 
activation/deactivation, to weird behaviour when showing sheets, to the 
impossibility of correctly activating and deactivating menu items in both Cocoa 
and Carbon...).

 The only case I've found works is having modal Cocoa windows in a Carbon 
application. All other things had this or that annoying issue, leak, or 
whatever.

 If you want my recommendation: Save yourself the trouble and just start 
porting the whole window to Cocoa. I generally create a new window controller 
class, and then recreate everything from the original class in the new one in 
Cocoa, step by step, starting with one method (e.g. the constructor and setup 
methods) and then porting all the methods called by this one. The model behind 
everything stays the same. That ensures the behaviour even of complex windows 
isn't unintentionally modified. Of course, you will have to change some things, 
but at least this way you don't accidentally miss something.

 That way, you can at least partially run the old code next to the new one and 
compare their behaviours, to make sure they're exactly the same.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to