Slashdot Mirror


Mono's Cocoa# Underway, GTK# Takes on Windows.Forms

Gentu writes "OSNews posted some exclusive screenshots of a new project in the Mono community: Cocoa#. Apparently there are a couple of Apple engineers helping out the project that allows developers to create graphical Cocoa applications under Mac OS X using the C#, Python or Basic language. Mono seems to be doing well in the Windows land too, allowing developers to use GTK# instead of Windows.Forms to create multi-platform apps."

30 of 378 comments (clear)

  1. Windows.Forms in Mono by miguel · · Score: 5, Informative

    I wanted to mention that our path to indepedence
    clearly goes through Gtk#, but we realize the
    importance of giving users binary compatibility
    so we are actively developing Windows.Forms and
    Visual Basic.NET (gasp) for Mono.

    A new from scratch implementation has started with
    four of the top Mono developers that are now
    locked up in Provo Utah working around the clock
    to delivery the new implementation of Windows.Forms
    (our previous Wine-based approach having too many
    Mono/Wine problems to solve).

    Miguel.

    1. Re:Windows.Forms in Mono by Matt+-+Duke+'05 · · Score: 4, Informative

      Perhaps actually trying to accomplish what you claim is impossible might help you out a bit. This took me about 30 seconds to do:

      using System;
      using System.Drawing;
      using System.Windows.Forms;

      namespace TreeTest {
      public class TreeTest : Form {
      [STAThread]
      public static int Main(string[] args) {
      Application.Run(new TreeTest());
      return 0;
      }

      public TreeTest() {
      tree = new Tree();
      tree.Dock = DockStyle.Fill;
      Controls.Add(tree);
      Text = "TreeTest";
      }

      private Tree tree;
      }

      public class Tree : TreeView {
      public Tree() {
      menuItem = new MenuItem("Menu Item");
      contextMenu = new ContextMenu();
      contextMenu.MenuItems.Add(menuItem);
      }

      protected override void OnKeyDown(KeyEventArgs e) {
      base.OnKeyDown(e);

      if (e.KeyCode == Keys.Apps) {
      ShowMenu(new Point(0, 0));
      }
      }

      protected override void OnMouseUp(MouseEventArgs e) {
      base.OnMouseUp(e);

      if (e.Button != MouseButtons.Right) {
      return;
      }

      ShowMenu(new Point(e.X, e.Y));
      }

      protected void ShowMenu(Point pos) {
      contextMenu.Show(this, pos);
      }

      protected ContextMenu contextMenu;
      protected MenuItem menuItem;
      }
      }

      --
      -Matt
      Duke '05
    2. Re:Windows.Forms in Mono by IamTheRealMike · · Score: 4, Informative
      It was, but there were communications issues. So now they're going to not only try to implement the entirely of S.W.F in C# (that's an entire widget toolkit!) but also a fake WndProc/Handle property for apps that rely on the underlying Win32ness of it.

      For *really* hard core apps (read: most .NET apps) that actually mix native and .NET code, they were talking about having a special "winelib" mode where it's somehow used, but I've not seen any credible technical details on this.

      Basically it looks like in order to run .NET code that is mixed with native Win32 code the Wine team will have to do their own S.W.F implementation one day. Currently there are no killer .NET apps that I know of (by killer I mean public/retail software sufficiently unique that it's a "blocks my migration to Linux" app, rather than custom corp apps) so it's not a big deal. But I expect they'll come eventually.

    3. Re:Windows.Forms in Mono by rhysweatherley · · Score: 4, Informative
      wtf? where is the windows.forms implementation under Linux? They are writing it from scratch because the previous version was using Wine and didnt work properly, so now they are doing it 'natively'.

      Microsoft hasnt written a windows.forms implementation under Linux - they are not playing 'catch up', they are implementing something that doesnt yet exist.

      Actually, it does. DotGNU Portable.NET has had a native implementation of SWF for over a year now. We discarded Wine as a viable option from day one.

      DotGNU Web Site.

  2. Patents? by Anonymous Coward · · Score: 5, Informative

    From the mono FAQ:

    Question 131: Could patents be used to completely disable Mono (either submarine patents filed now, or changes made by Microsoft specifically to create patent problems)?

    ... The controversial elements are the ASP.NET, ADO.NET and Windows.Forms subsets. Those are convenient for people who need full compatibility with the Windows platform, but are not required for the open source Mono platform, nor integration with today's Mono's rich support of Linux.

  3. wxWidgets, another _perfect_ alternative with Mono by after · · Score: 4, Informative

    I've been using wxWidgets for some corperate develpment and I don't think I can be more happy with it. Integrating Cocoa into Mono is nice with GTK and all (didn't read article- sorry,) but is it going to use native UI faculties that the operating system provides? wxWidgets even has .NET interpolabilito under development called wx.NET and you can use that with Mono too.

  4. Re:Mono vs. Java (again) by Anonymous Coward · · Score: 3, Informative

    Huh? Pardon me, but how much Swing development have you done on OSX? I've done plenty as OSX was to be my primary development environment, targetting windows users. After about a month of that, I now do most of my development on an XP laptop.

    There are NUMEROUS outstanding issues with Apple's JVM. First off, the perfomance is significantly slower than on Windows ( this is comparing my Dual G5 w/1GB RAM to a 2.2GHz Celeron w/512M laptop ).

    Secondly, the setFont() function is completely ignored for JTextArea and defaults to monospaced serif fonts and white backgrounds.

    There are too many problems to list here, but honestly, Swing/Java for OSX is nowhere near the quality of the Windows or Linux implementation ( even as much as I wish it was ).

  5. Windows forms sucks by Anonymous Coward · · Score: 2, Informative

    Really. You'd think Microsoft could come up with something better than the grid-based layout they have been since forever. Once you start using a constraint based layout kit like Gtk, you never want to go back to the stone age and have to manually write window resize code and manually adjust the sizes of controls individually. I'm hoping to try out Gtk# soon for projects now that we are starting to use .Net as a development platform.

    1. Re:Windows forms sucks by IamTheRealMike · · Score: 2, Informative

      Dude, I can't agree. Dialog units are an awful hack Microsoft added to cover up for the lack of design they put into the dialog manager originally. Anchoring is not superior to constraint-based layout once you take into account things like translations which can radically modify the size of strings at runtime. I think you equate anchoring with "flexible" because you are used to dropping controls at arbitrary points. This sort of flexibility just shoots you in the foot later though. Taking the time to learn constraint-based layout - wierd though it is at first - will not be wasted.

  6. Re:Why doesn't mono get it (winforms)?? by cujo_1111 · · Score: 3, Informative

    C# != .NET CLR

    The C# language may be a standard but the .NET runtime is a MS proprietary object.

    --
    If I point out that you are incorrect, making me a foe does not make you any more correct.
  7. Re:Question about GTK# by Anonymous Coward · · Score: 1, Informative

    No, cygwin is not required to run Gtk#, only to build it from source.

  8. Re:Cocoa on top of Mono? by jcr · · Score: 2, Informative

    Even better would be finishing up the GNUStep project.

    -jcr

    --
    The only title of honor that a tyrant can grant is "Enemy of the State."
  9. Re:Cocoa on top of Mono? by ArbitraryConstant · · Score: 3, Informative

    It would be nice to have a consistent multi-platform Objective C library period.

    Forget about GUI bindings, all the different implementations don't even share the same root object.

    --
    I rarely criticize things I don't care about.
  10. Re:you have got to be joking by azav · · Score: 4, Informative

    The reason behind the 1 button mouse was that it was painfully clear what the 1 button was to be used for. If you wanted "right button style functionality," hold down the option key and click.

    Studies done at the time indicated that people made more mistakes with multi button mice and mice with multi button interfaces took longer for the user to accomplish what they want to do (because of the mistakes and confusion about what the other button was for).

    For me, it is pretty damn obvious that the mouse button is used to provide the "primary operations" for the item clicked on. Holding down the option key when clicking to extend into "options" for the item makes perfect sense to me.

    What really is the big deal with people's obsession on multi button mice? Honestly, I don't get it.

    --
    - Zav - Imagine a Beowulf cluster of insensitive clods...
  11. Re:Question about GTK# by DAldredge · · Score: 5, Informative

    That is only to build the software, you do not need to have Cygwin installed to run GTK# apps.

  12. Re:Cocoa on top of Mono? by jcr · · Score: 4, Informative

    The number of people still using the original root class, Object, is vanishingly small. GNUStep has a perfectly good implementation of NSObject, which tracks the Apple implementation quite well.

    -jcr

    --
    The only title of honor that a tyrant can grant is "Enemy of the State."
  13. Also: Mono Project 1.0.1 Released by DAldredge · · Score: 5, Informative

    http://www.mono-project.com/downloads/

    Mono 1.0.1 has been released and fixes a number of bugs.

  14. Re:Guide for newbies by OmegaBlac · · Score: 4, Informative

    You can look through the ECMA document for a Hello World example. Also check out last months Ars Technica Linux.Ars article on Mono as it provides a couple of examples too.

  15. Re:Guide for newbies by OmegaBlac · · Score: 2, Informative

    Quick little "Hello World" in C#:

    using System;

    class Hello
    {
    static void Main() {
    Console.WriteLine("hello world");
    }
    }

  16. Re:I think the world has finally left me behind by richardfish · · Score: 2, Informative

    Because .NET is the only platform that exists today that allows you to re-use code written in other languages *without* writing a single interface function. Although Mono only has a C# compiler today, I believe others will follow with compilers/interpreters for (managed)C++, Obj C, Ruby, Python, Java, etc. So write your assembly in C# today, and re-use it tomorrow in Java, or give it to your co-working using C++.

  17. Re:Question about GTK# by krumms · · Score: 2, Informative

    Getting Gtk# running on Windows can be a bitch.

    So try this :)

  18. Re:Slow? by droleary · · Score: 3, Informative

    Is this based on anything? It's slower than raw C or assembly of course, but quite fast overall.

    More importantly, no language is faster than a programmer who doesn't know algorithms. Looking at the "S-L-O-W" code through the link provided, it's some of the shittiest toy benchmarking I've ever seen. It compares static strings through an inner method call and nested inside two loops! Even a freshman seeing that code would have had the sense to move the compares outside all that. So in 10 seconds, I was able to take code that was claimed 6x slower than Java and make it 2x faster than Java. Of course, it is still a toy benchmark that accomplishes nothing of value.

  19. Re:Ahem, The CLI is just as much of a standard as by Anonymous Coward · · Score: 1, Informative

    C# is an ISO standard too.

    ISO/IEC 23270:2003
    Information technology -- C# Language Specification

  20. Re:Slow? by IamTheRealMike · · Score: 2, Informative
    Well, the problem is that you have all these messages which are internal to an app being passed back and forth and each one requires a cross module call which in the Mach-O ABI is very inefficient. In standard compiled code an internal function call is 1 instruction - for crossing DSO boundaries you have to dereference the GOT so it's maybe 2 instructions. It's not much. Crossing into the ObjC runtime on Mach-O is very slow due to the way it wasn't designed for PowerPC, then you have to transition *back* again, and objc_msgSend() isn't exactly a 5 opcode call, so you have all the overhead of this: remember this is taking place for *all* internal method calls.

    Basically it stacks up. But that's not the primary disadvantage of Objective-C. The primary disadvantage is that it's not kept pace with the times and nobody knows it. Why would you go for a C variant with wierd syntax that isn't fully garbage collected, when you can go for something very familiar, that is fully garbage collected?

    Obj-C went nowhere for the same reason that Lisp and SmallTalk didn't : familiarity was more important to people than theoretical elegance. Next to that the badly designed ABI is peanuts.

  21. Re:Question about GTK# by miguel · · Score: 2, Informative

    Mono 1.0.1 has a new Windows installer that gets
    you Gtk# working by default, it is no longer a
    separate compilation.

    Thanks to Paco and Gonzalo for making this
    happen.

  22. Re:you have got to be joking by dan+the+person · · Score: 2, Informative

    The studies done for the orignal macintosh that came to those conclusions was for first time computer users.

    Which is quite understandable. But most people these days aren't first time computer users, hence the popularity of multi button mice

  23. Re:answer by bnenning · · Score: 4, Informative

    C# and Java provide "reflection" APIs for implementing things like this. It would be quite easy to create a class entirely analagous to NSUndoManager in either language

    No it wouldn't. Check the documentation; NSUndoManager intercepts *any* message sent to it, and stores it for later invocation on a different target. You can't do that with reflection, which only allows you to call one of a fixed number of methods.

    Another example: there are third party libraries that add higher order messaging to Cocoa collection classes. They allow you to write code like "[[array select] isFroody]", which will return all objects in array for which the method -isFroody returns true. Again, the initial "isFroody" message is intercepted, then forwarded to each object in the array.

    --
    How to solve most of our problems: 1.Lots of nuclear plants. 2.Cure aging.
  24. Re:GTK# is NOT ready by Nurgled · · Score: 2, Informative

    It sounds to me like your current approach is how it should be done. Make sure none of your other code depends on the UI and then just write several UI layers. That way it'll look native wherever you run it.

    In my opinion, GTk# on Windows should just be used to run software that was never intended to run on Windows, as a compatibility layer in similar ven to Cygwin. If you are actually indending your application to be cross-platform, having several switchable GUI layers is the way to go. Later on, if it seems worthwhile, you can put a Cocoa# GUI layer on it too and you have a Mac version with no change to the guts of your application. You could even make a terminal-based user interface to parts of your core application as appropriate without changing the "interesting" parts at all. If your app is open source, other people might even contribute alternative interfaces for you!

  25. Re:I bid C# welcome by dasmegabyte · · Score: 2, Informative

    C# is kind of like Java, but it's also kind of like VB, kind of like C++ and kind of like a dozen other languages. New languages are almost always an assembly of the most popular languages at the time of their development with a slightly different syntax. Personally, I like some of the C# advantages over Java a lot (e.g. modifiers that allow you to expose methods either by namespace/package or by assembly, delegate messaging, true properties, compiler directives and the fact that you aren't forced to declare exceptions). But I am the first to admit they're incremental.

    --
    Hey freaks: now you're ju
  26. Re:I think the world has finally left me behind by namekuseijin · · Score: 2, Informative
    They're also compiled to an intermediate language, so they're faster than scripting languages (yes, Python and Ruby have various different compilers to build C code, java bytecode, .NET IL code, etc, but in their vanilla forms they're interpreted scripting languages).

    This is incorrect.

    Perl, Python and Ruby standard implementations don't work by sluggishly interpreting each line of code everytime, like the old, putrid Basic interpreters from the 80's. They *do* compile the text source code to an internal, more convenient form: Python to bytecode and Ruby and Perl to an internal graph structure.

    What do make Java and C# faster to execute is that type-checking is done at compile time, while in dynamically typed languages like those above the checking is done at runtime.

    However, you get faster execution by having the developer of statically-compiled languages to explicitly declare every and all variables and parameters with the correct types, and this clearly is overkill for many application software.

    Dynamically-typed languages get this burden off the developer by providing an execution environment which does exactly that at the cost of some execution overhead. The developer is then freed from the boresome and mechanical type declarations to worry about more important matters, such as actually making the code do something useful.

    One would reply: "But you lost all benefits from getting correctly compiled code.", like as if the compilation stage doesn't report lots of errors in dynamically-typed languages or if the compilation itself was proof that the software is free of bugs and doesn't need to be thoroughly tested for runtime errors.

    I ask, if you still need to go through the pain of testing thoroughly, what real benefits come from statically-compiled languages other than execution speed and perhaps some subtle runtime bugs difficult to discover? Is it worth to lose conciseness or development time just for it?

    Here's a lovely trivial example in C#, using the standard .Net framework. This is how i declare a RadioButtonList webcontrol in ASP.NET:

    using wctl = System.Web.UI.WebControls;
    .
    .
    .
    protected wctl.RadioButtonList lstACTY_CD_ID;

    Well, that wasn't so bad, and then there's semantic autocompletion of symbols (something M$ marketing dept calls "Intellisense") -- if you're using a featurefull IDE, that is -- which automatically provide you with a quick selection and online documentation of all available completions or operations for the symbol just left of the cursor. Yes, writing type declarations with such tool is trivially easy, though reading through them afterwards and mantaining the code-base is not. Don't understand yet? Here's a very nasty, and yet very common taste of stupid statically typed syntax, following the same example above:

    this.lstACTY_CD_ID.SelectedIndex = lstACTY_CD_ID.Items.IndexOf(lstACTY_CD_ID.Items.Fi ndByValue(accident.Type.ACTY_CD_ID.ToString()));

    No, i'm not kidding: this is how you preselect some item in a radiobutton list given a particular value from the same datasource. That is real production code from an app i'm working on here at work. Well, at least, in the end it could be worse: like most other people doing .Net development, i could be writing .Net code in VB! Ouch!

    So, in the end, it's all a matter of what you value most: development time versus execution time; verbosity vs. conciseness. Noting that execution time should, for most purposes, be made irrelevant in about 6 months and faster and cheaper hardware.

    --
    I don't feel like it...