[Mono-winforms-list] Windows.Forms usage

Mike Hearn m.hearn@signal.qinetiq.com
16 May 2003 09:37:53 +0100

On Fri, 2003-05-16 at 06:44, Adam W Root wrote:
> I'm an MS.NET developer switching to mono on linux. 

Heya, welcome :)

> I know the
> Windows.Forms classes are under heavy development, but I was hoping
> someone could shoot me an example use of them, as I haven't been able to
> get anything with them to run.

Hmm, the methods used for this are still in flux. I suspect the next few
Mono releases will make using SWF a lot easier, but I'm not on the Mono
team so I couldn't really say.

> Also, what is this Wine vs GTK stuff? 

GTK is one of the native Linux toolkits (probably in my opinion more
'native' than Qt is, but as they are both cross platform the point is

A lot of software is written for it. GTK was designed and written for
free platforms, but has been ported to Win32 as well, see
gtk-wimp.sf.net for some screenshots of it integrating with the XP theme

One of the original ideas was to map System.Windows.Forms to GTK, so
.NET apps written for Windows would adopt native widgets. Unfortunately,
that turned out to not work very well for many apps, as SWF is a "leaky"
API - it exposes a lot of Win32 concepts like the message dispatch
system etc. So, the decision was made to bind Mono to Wine.

Wine is our Windows Emulator (and is what I work on). It allows you to
run Win32 EXE files, as well as recompile them for Linux. It's a free
(as in LGPL free) implementation of the Win32 APIs, and as such the
project has cloned the Win32 widget toolkit. It emulates things like the
windows messaging system at the binary level, so is a much closer match
for SWF.

The main problem is that Wine is, to quote the website, alpha software.
That's a euphamism for buggy :) As you know, Win32 is a total beast of
an API. So, the widget toolkit is not really as mature as GTK is, it
doesn't integrate with the native look and feel (see screenshots on
winehq.com) and some of the widgets are stubs. But overall it's probably
a better approach.

> I know they are some sort of
> xwindows forms implementations. So is Windows.Forms supposed to
> integrate with these so that you won't see that layer? 

Yup. You won't have to worry about how Mono implements it to simply use
it (or run .net apps written for it).

> In other words,
> will my IL on my mono/linux box run on a MS.NET box? 

There are two approaches if you want to do this. The best is to use GTK#
natively in your app. As you can see from the GTK-Wimp screenshots, GTK
integrates with Windows a lot better than Wine does with Linux. It's
also got a more sane API, which makes things like internationalization

You can target SWF if you want. But, your app will end up feeling rather
out of place on Linux until we can implement UXTHEME support in Wine,
which is a huge task (ie it won't happen for a long time unless somebody
gets funding to work on it). Even then, Wine is a large dependancy for
an application to have.

> (Once again, i know the classes are incomplete, i'm working with the idea).

Very incomplete. At this stage of the game, you would be filling out the
stubs as you went. Even Wine itself is not complete (no richedit
control, flat scrollbar maps to normal scrollbar, no webbrowser control
etc etc).

thanks -mike

Mike Hearn <m.hearn@signal.qinetiq.com>
QinetiQ - Malvern Technology Center