-----------------------------------------------------------
New Message on cochindotnet
-----------------------------------------------------------
From: spark
Message 1 in Discussion
Hi Folk,
Ever since Linux Bangalore I have been thinking about something that Miguel de
Icaza had been upto on stage there. He demoed their ui generator Glade and
showed how Glade generates UI markup. They were also joking as to how XAML is an
idea that they had thought of 6 years back, to use XML markup for representing
UI and seperating 'business logic' from UI.
He also went on to show how Glade is used to generate GTK# UI in linux. A
'.glade' file is simply an xml file that contain tags that correspond to the
properties of the controls (or widgets as they call them). The strange thing was
how they used glade files - in XAML you compile the xml file to genrate a class
(or what MS calls a partial class, one that can be extended elsewhere). In glade
they did no such thing, they simple wrote a cs file and called one Glade API
function passing it the name of '.glade' file. That returned some kind of object
and presto they had their UI. Now the claim was that this really separates the
UI from the code and as a matter of fact the XML can be chnaged after the exe
file has been compiled. Changes to the XML will reflect in the UI without
recompilation of anything. They also mentioned that Microsoft hasnt figured out
how to do this yet.
Now this got me thinking, a result of which is WFML. It was rather surprising how
easy this was to do.
I am sure Miggy's code will be better and more optimised, but I think my general
direction is correct. In short WFML provides (or atleast hopes to provide) a
markup language for UI that simply does not have to compiled (in the
conventional sense). Now if you have ever tried writing a Win forms application
by hand without studio, you will remember
how hard it is to remember so many of the things required - take a look at some
WFML based code:
//win.cs
using
System;
using System.Windows.Forms;
using
System.Windows.Forms.Markup;
class CMain
{
static
void Main()
{
IAttachable win = new
Wfml().CreateUserInterface("win.wfml","MainWindow");
Application.Run((Form)win);
}
}
Simple ? And you
simply write the .wfml file like this (win.wfml):
<Window
Name="MainWindow"
Height="200"
Width="400"
/>
Now compile the
cs:
csc /t:winexe /r:System.Windows.Forms.Markup.dll win.cs
Run win.exe and you
will see a window
The following code
display a button and a text box.
<Window
Name="MainWindow"
Height="200"
Width="400"
Text="Main Window"
>
<Button Name="mybutton"
Top="10"
Text="Click
Me"
/>
<TextBox
Name="tbox"
Top="40"
Left="5"
Width="200"
/>
</Window>
And you can even
attach event handlers and write back to the UI
using
System.Windows.Forms;
using System.Windows.Forms.Markup;
using
System;
class CMain
{
public TextBox
tbox;
public void clicked(object sender, EventArgs
e)
{
tbox.Text+="+
";
}
static void
Main()
{
IAttachable win = new
Wfml().CreateUserInterface("win.wfml","MainWindow");
CMain cm =
new
CMain();
win.AttachConsumer(cm);
Application.Run((Form)win);
}
}
Do try some
WFML, the supported types are Button, TextBox and Label - but I guess the rest
can be added easily. Now I dont htink
this was anywhere as hard as they were making it out to be on
stage.
Rosh
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/cochindotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]