[Mono-osx] .exe using Winforms and Monobjc/Cocoa (success)

Andrew Brehm ajbrehm at gmail.com
Wed Dec 17 10:28:10 EST 2008


I know about Mono's built-in Winforms support on Linux and Mac OS.

Rewriting GUIs for each platform is the way to go, I think. I was
thinking about an automatic converter not as an end, but as a tool to
assist the porting process. The GUI must then be altered manually to
conform to Mac OS' UI guidelines. But the initial step of creating a
NIB file could be automated. Such a NIB file would be totally unusable
for the program until all the controls are moved around a bit, of
course.

In general, I would start with Windows Forms and then create a Monobjc
version for Mac OS and possibly, if I have the time, a GTK# version
for Linux. (Any ideas about WxWidgets for .NET? Any good?)


On Wed, Dec 17, 2008 at 3:13 PM, Duane Wandless <duane at wandless.net> wrote:
> Just my two cents.  Cross platform is a nice concept.  Mono and monobjc are
> a great step in the right direction.  You can run WinForms apps on Linux and
> Macs today, with certain limitations.  But those applications look terrible
> on non-Windows platforms.  Of course anything is possible, but no one has
> truly solved the cross platform GUI issue, write once deploy many  Qt, Java,
> Mono all attempt and all fall short.
> If you want a Windows application use WinForms/WPF.  If you want an OSX
> application use Interface Builder.  Thanks to the work of mono and monobjc
> we cross platform developers can reuse the majority of our C# code across
> Windows and Macs.  I believe it is a small price to pay to write twice the
> GUI specific code so that I can truly have a native looking application on
> both platforms.  On Macs, generally speaking they are very unforgiving for
> non-standard Mac UIs.
>
>
> On Wed, Dec 17, 2008 at 9:56 AM, Andrew Brehm <ajbrehm at gmail.com> wrote:
>>
>> Hiya,
>>
>> I'll try the different calls. Thanks.
>>
>> I know this would be a ridiculously huge project, but do you think there
>> is
>> a possibility of creating an auto-converter that would look at Windows
>> Forms
>> GUI code and create a NIB file containing the equivalent controls, so that
>> the porting programmer would only have to write some glue code and set
>> connections? Is this even possible/feasible (I assume it is possible) or
>> worth the effort?
>>
>> I assume you have more important things to do. I'll see what I can figure
>> out.
>>
>> I do believe that portability from Windows to Mac OS would be one of the
>> most important factors for most people once it has been established that
>> Mono and Monobjc can be used to port Windows Forms applications to Cocoa.
>>
>> I'll go and read the Cocoa documentation as you suggest.
>>
>>
>>
>> Laurent Etiemble wrote:
>> >
>> > Hello,
>> >
>> > First, thank you for supporting Monobjc.
>> >
>> > For your NIB loading issue, know that there is two ways to load a NIB
>> > file
>> > and each has a different behavior:
>> > - The "loadNibNamed:owner:" message use a name to locate the file
>> > (neither
>> > path nor extension required). The owner will tell how to lookup the NIB
>> > file
>> > (if you pass the shared NSApplication object, then the Resources folder
>> > of
>> > the bundle will be searched).
>> > - The "loadNibFile:externalNameTable:withZone:" message uses a relative
>> > or
>> > an absolute path to locate the NIB file. As a bonus, you retrieve an
>> > array
>> > containing the top level objects that were created.
>> >
>> > I suggest you to read the NSBundle class reference (along with the
>> > AppKit
>> > additions). Let me know if you have some success.
>> >
>> > Regards, Laurent Etiemble.
>> >
>> >
>> > 2008/12/16 Andrew Brehm <ajbrehm at gmail.com>
>> >
>> >>
>> >> Hi, thanks for the reply.
>> >>
>> >> I know the way to handle NIBs is the official way. But I wish there
>> >> were
>> >> an
>> >> alternative way to handle them for debugging. It's not so important. I
>> >> can
>> >> live with it. :-)
>> >>
>> >> What about NIB 3.x?
>> >>
>> >> I will help by using Monobjc. Couldn't see the paypal button at first
>> >> as
>> >> I
>> >> use OmniWeb and it shields me from seeing expensive things.
>> >>
>> >> Thanks,
>> >> Andrew
>> >>
>> >>
>> >> Laurent Etiemble wrote:
>> >> >
>> >> > Hello,
>> >> >
>> >> > My comments inline.
>> >> >
>> >> > Regards, Laurent Etiemble.
>> >> >
>> >> > 2008/12/15 Andrew Brehm <ajbrehm at gmail.com>
>> >> >
>> >> >>
>> >> >> My second test of Monobjc is a program (StupidWordCounter, the same
>> >> >> example
>> >> >> I
>> >> >> used for Cocoa#) that uses a NIB file or a Windows.Forms GUI
>> >> >> depending
>> >> on
>> >> >> which platform it runs on. (It checks for a directory
>> >> >> "/System/Library/Frameworks/Cocoa.framework" to determine if it is
>> >> >> running
>> >> >> on Mac OS.)
>> >> >>
>> >> >> I made a few screenshots of the development process in Visual Studio
>> >> 2008
>> >> >> and Xcode 3. I'll upload them in tutorial form in the next few days
>> >> and
>> >> >> give
>> >> >> the URL here.
>> >> >>
>> >> >> Remaining issues:
>> >> >>
>> >> >> 1. The path to the NIB file as used by Monobjc confuses. Apparently
>> >> this
>> >> >> past must be relative to the .app bundle containing the assembly.
>> >> >> This
>> >> is
>> >> >> useful for the finished program but makes testing/debugging
>> >> >> difficult.
>> >> >
>> >> >
>> >> > This is the official way to locate the NIB and Monobjc conforms to.
>> >> >
>> >> >
>> >> >
>> >> >>
>> >> >>
>> >> >> 2. I still have an awful lot of platform-specific code in two
>> >> >> classes
>> >> for
>> >> >> each GUI. I wonder if there is an elegant practice for dealing with
>> >> this
>> >> >> (and whether using native GUIs rather than a crossplatform GUI
>> >> >> toolkit
>> >> is
>> >> >> really the way to go).
>> >> >>
>> >> >> 3. Can Monobjc use XIB files? If yes, how? Interacting with NIB
>> >> >> files
>> >> is
>> >> >> a
>> >> >> hassle with Xcode 3, which by default wants XIB files and doesn't
>> >> >> even
>> >> >> let
>> >> >> you create IB 2.x NIB files easily.
>> >> >
>> >> >
>> >> > XIB is only a development format, not a deployment one. Quoted from
>> >> >
>> >>
>> >> http://developer.apple.com/documentation/developertools/conceptual/IB_UserGuide/BuildingaNibFile/chapter_3_section_2.html
>> >> > :
>> >> >
>> >> > "The xib file format was also introduced in Interface Builder 3.0 as
>> >> > a
>> >> > development-time format and was conceived as a way to provide tighter
>> >> > integration with your Xcode projects, particularly in the areas of
>> >> > SCM
>> >> > support, diff support, and refactoring. Xcode automatically converts
>> >> files
>> >> > in the xib format to the nib format at build time."
>> >> >
>> >> > If you look at the build process in XCode, you will see that the XIB
>> >> file
>> >> > is
>> >> > compiled into a NIB one. Monobjc build tasks allow you to do the
>> >> > same.
>> >> > Check http://www.monobjc.net/index.php?page=building-tools for more
>> >> > details
>> >> > on the <ibtool/> task.
>> >> >
>> >> >
>> >> >
>> >> >>
>> >> >> But all-in-all I remain very convinced that Monobjc is the greatest
>> >> thing
>> >> >> since sliced .NET.
>> >> >>
>> >> >> Any chance that it become part of the default Mono distribution?
>> >> Novell?
>> >> >> Buy
>> >> >> Monobjc?
>> >> >
>> >> >
>> >> >>
>> >> >> And if anyone from the Monobjc team reads this: is there a way I can
>> >> >> help?
>> >> >> I
>> >> >> am a bad programmer but excellent user. Can I at least donate or
>> >> >> something?
>> >> >
>> >> >
>> >> > You can help by simply using Monobjc. We need the users' feedback to
>> >> > refine
>> >> > the API and find bugs.
>> >> > You can also make a donation via PayPal (the button is on the
>> >> > download
>> >> > page).
>> >> >
>> >> >
>> >> >>
>> >> >>
>> >> >> Happy Holidays.
>> >> >>
>> >> >> Andrew
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> >> http://www.nabble.com/.exe-using-Winforms-and-Monobjc-Cocoa-%28success%29-tp21011520p21011520.html
>> >> >> Sent from the Mono - OSX mailing list archive at Nabble.com.
>> >> >>
>> >> >> _______________________________________________
>> >> >> Mono-osx mailing list
>> >> >> Mono-osx at lists.ximian.com
>> >> >> http://lists.ximian.com/mailman/listinfo/mono-osx
>> >> >>
>> >> >
>> >> > _______________________________________________
>> >> > Mono-osx mailing list
>> >> > Mono-osx at lists.ximian.com
>> >> > http://lists.ximian.com/mailman/listinfo/mono-osx
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> >> http://www.nabble.com/.exe-using-Winforms-and-Monobjc-Cocoa-%28success%29-tp21011520p21031349.html
>> >> Sent from the Mono - OSX mailing list archive at Nabble.com.
>> >>
>> >> _______________________________________________
>> >> Mono-osx mailing list
>> >> Mono-osx at lists.ximian.com
>> >> http://lists.ximian.com/mailman/listinfo/mono-osx
>> >>
>> >
>> > _______________________________________________
>> > Mono-osx mailing list
>> > Mono-osx at lists.ximian.com
>> > http://lists.ximian.com/mailman/listinfo/mono-osx
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/.exe-using-Winforms-and-Monobjc-Cocoa-%28success%29-tp21011520p21054526.html
>> Sent from the Mono - OSX mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Mono-osx mailing list
>> Mono-osx at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-osx
>
>


More information about the Mono-osx mailing list