[Gtk-sharp-list] Help
George Farris
farrisg@mala.bc.ca
03 Feb 2003 10:00:44 -0800
Any way to run something like bindtotext? Or have internationalization?
On Mon, 2003-02-03 at 08:57, Miguel de Icaza wrote:
> Hello,
>
> > I am quite new at this side of the track so please bear with me.
> > I have a winform code that was written and compiled fine with C#/SDK.
> > I am now trying to convert it to gtk#/mono and having a heck of a
> > time.
>
> This is very good tutorial/HOWTO material. I have CCed mono-docs-list
> to see if someone is interested in stepping up and doing a `Winforms
> to Gtk# porting tutorial'.
>
> > for example, how do i convert these line of codes to gtk#/mono
>
> The first thing to keep in mind is that the use of absolute
> positioning on a form is not recommended when using Gtk.
>
> The problem arises when a user changes his font, or is using the
> application in another country. For example the common "Ok" button
> would become "Aceptar" in spanish. So any absolute positioning is
> considered a bad idea.
>
> So in Gtk, you use widget containers to lay things out.
>
> Second, in Gtk you would not put the layout code directly into the
> source, because we consider this tedious. So you would do this using
> "glade-2". With Glade-2 you would design your form, and say, save it
> into `sample.glade'. Then you would load the UI from there (see the
> tutorial, there are examples on how the GUI is loaded, and events and
> widgets connected).
>
> Your example using Gtk# and Glade would look like this:
> using Glade;
> using System;
>
> class Boot {
> static void Main ()
> {
> Application.Init ();
> Form f = new Form ();
> Application.Run ();
> }
> }
>
> class Form {
> Glade.XML ui;
> [GladeWidget]
> Button button1;
>
> [GladeWidget]
> Entry entry1;
>
> Form ()
> {
> ui = new Glade.XML ("sample.glade", "window1", null);
> ui.Autoconnect (this);
> }
>
> void on_button_clicked (object o, EventArgs e)
> {
> Console.WriteLine ("I got clicked");
> }
> }
>
> In Glade, you would have to layout your widgets, and put a button1,
> and entry1 widgets.
>
> See my attached images for details:
>
>
> This is the GUI designed for the example above.
>
>
> Notice that I have set the widget name to "button1",
> and that the label is set there to "OK". Also notice
> my huge font, because I cant read
>
>
>
>
> Select the "Signals" tab in the "Ok" button,
> and click on the button shown above to add
> a signal handler.
>
>
>
> Select the signal clicked
>
>
> And now click on "Add" to add the signal
> handler. This is very important. Do not
> forget, or the binding to your C# function
> will not be there.
>
> Miguel.
--