[Mono-osx] 3 cross-platform questions

Mac Programmer MacPgmr at fastermac.net
Tue Feb 24 19:58:07 EST 2009

I've been enlivened by the recent discussions of Cocoa, Prism, etc.  
so much so that I've now officially dipped my toe into the Mono  
waters. Here are some questions that I can't answer myself at this  

(1) How does one create a true cross-platform custom control, meaning  
a control that functions both with WinForms and Cocoa? It appears as  
though in the .Net world most custom controls are UserControl  
descendants, which would apparently mean that the custom control is  
WinForms-only. Is there some other way? The custom control I have in  
mind is in a nice fat 1.5MB assembly far to big to consider rewriting  
from scratch and it's a UserControl descendant. It works perfectly on  
Mac with Mono, although the resulting WinForms app it's used in is  
ugly. On most days of the week I'll go ugly rather than nothing, but  
is there any other way?

For example, is there some way to drop a Cocoa-simulated UserControl  
below the custom control or would you have to simulate the entire  

(2) Is there a way to create a Cocoa app in Mono without using  
a .nib? I've been able to get it down basically to an empty .nib,  
without a main window or main menu, and then create the main window  
and its controls and event handlers in code, but it seems as though  
some kind of application controller class that's linked to a  
minimal .nib is required. I've only done this with Prism and Cocoa#  
so far, but it should work with C# and the other Cocoa wrappers too.

I find that creating the UI in code is more satisfying at this point  
than working with IB, which strikes me as sub-RAD. This also  
eliminates the need for [Export] and [Connect] attributes (meaning  
the application controller class is starting to resemble a WinForms  
Form class).

(3) Is it possible to mix and match the GUI's? For example a  
System.Windows.Forms.Form with a Cocoa main menu. WinForms on the Mac  
is apparently implemented using the Carbon framework, which should co- 
exist okay with the Cocoa framework, but maybe WinForms itself won't  
co-exist with anything else.

I appreciate the challenges of cross-platform GUI development, but  
the suggested solution (VM, VS, IB, etc.) sounds like a 12-step  
program designed to wean frustrated Mac developers from their Macs.



More information about the Mono-osx mailing list