[Gtk-sharp-list] GTK# App with multiple windows, where does Application.Init() and Application.Run() go?

Zac Bowling zac@zacbowling.com
Mon, 28 Mar 2005 11:48:50 -0600


Application.Init() should always come before any code that may take
place that will start to create Gtk# objects. This will initialize
things that need to take place for Gtk# to work. After you get done
seting everything up that need to take place when you frist start, you
then call Application.Run(). Application.Run() is blocking so the code
can't continue on. What it is doing is running in a loop until a
Application.Quit is called. This makes it so that you application
doesn't keep running on its main thread after showing the window and
then disappear all of a sudden. Pretty easy huh? 
:-)

If you still need help see
http://www.mono-project.com/GtkSharpBeginnersGuide
Its not yet done but still a nice guide.

Hope that helps :-)

Zac

On Mon, 2005-03-28 at 12:30 -0500, Bet's On! wrote:
> This is probably what he meant:
> 
> Using Boo (http://boo.codehaus.org)'s interactive shell, you can
> programmatically "design" GTK# applications in real time and see them
> updated on the fly--for those of you who don't like the way Glade's
> looking at you and/or your girlfriend. You can instantly see the
> result of modifying the "Clicked" event handler of a button by, well,
> something like,
> 
> button.Clicked += { print "Hello, world!" }
> 
> Me? Glade keeps looking at me kinda cross-eyed. I'll wait for Stetic, thanks.
> 
> 
> On Sun, 27 Mar 2005 22:59:32 +0200, Timothy Parez <timothyparez@linux.be> wrote:
> > Huh ?
> > You kinda lost me now.
> > 
> > -----Oorspronkelijk bericht-----
> > Van: Rafael Teixeira [mailto:monoman@gmail.com]
> > Verzonden: zondag 27 maart 2005 20:18
> > Aan: Anset
> > CC: Timothy Parez; gtk-sharp-list@lists.ximian.com
> > Onderwerp: Re: [Gtk-sharp-list] GTK# App with multiple windows, where does
> > Application.Init() and Application.Run() go?
> > 
> > Also, for those using Boo interactive shell, and maybe (untested) with
> > the c# shell, you can build GTK UI interactively: You add a button
> > with a line of code and see it be added to the running window, what is
> > a nice way to really learn (and develop with) gtk#.
> > 
> > Just my two cents,
> > 
> > On Sun, 27 Mar 2005 12:40:20 +0200, Anset <Anset@anset.org> wrote:
> > > Hi,
> > >
> > > At first, it takes some getting used too, but now I make my gui's faster
> > > than I did with glade. Add to that that some functionality is not
> > > exposed through the glade interface, and I come out ahead twice. :)
> > >
> > > Seriously, if you need a very simple front end for an app, then glade is
> > > great. However if you want to have a nice gui, where you have full
> > > controll, not using glade is easier.
> > >
> > > The way you have to bind your methods to the glade widgets is just to
> > > cumbersome...
> > >
> > > I guess it all depends on what you are doing. :)
> > >
> > > The reason I let go of glade was that I was just learning to use Gtk
> > > (about 8 month ago now) and I was seeing some realy strange exceptions
> > > in Gtk/Gdk... The only way to debug my application (in absence of a
> > > usable mono debugger) was to rewrite everything without using
> > > glade(lib). And the moment that was done, those crashes mysteriously
> > > dissapeared...
> > >
> > > I haven't used glade since. :)
> > >
> > > But I have to admit that I am a controll freak when it comes to my
> > > programming. I hate visual designers... :)
> > >
> > > As far as I know, glade is the only Gtk+ designer at the moment. The
> > > Monodevelop people say that they will develop a new designer because
> > > glade does not work for them (I don;t have details) but they have not
> > > released anything yet...
> > >
> > > I thought that the Sharpdevelop ide had a desinger, but I think it only
> > > wotks with windows.forms, not Gtk.
> > >
> > > But as I have said, I don;t use them so my knowledge may be limited.
> > >
> > > Wkr,
> > >
> > > Anset.
> > >
> > > Timothy Parez wrote:
> > > > I am wondering though,
> > > > If you don't use glade, how do you visualize what you're doing, doesn't
> > it
> > > > take ages to create an GUI that looks exactly like you want it ?
> > > >
> > > > Will there be (is there) a GTK# designer that writes C# code without
> > using
> > > > Glade?
> > > >
> > > > Thnx
> > > >
> > > > -----Oorspronkelijk bericht-----
> > > > Van: gtk-sharp-list-admin@lists.ximian.com
> > > > [mailto:gtk-sharp-list-admin@lists.ximian.com] Namens Anset
> > > > Verzonden: zaterdag 26 maart 2005 19:02
> > > > Aan: Bjoern Schiessle
> > > > CC: gtk-sharp-list@lists.ximian.com
> > > > Onderwerp: Re: [Gtk-sharp-list] GTK# App with multiple windows, where
> > does
> > > > Application.Init() and Application.Run() go?
> > > >
> > > > True,
> > > >
> > > > but as I wrote at the end, ditch glade. It's great for a quick app, but
> > > > if you want to do anything fancy at all, it just won't work.
> > > >
> > > > Allso, I hate not being in controll of my own application. Glade just
> > > > makes things complicated and it certainly does not help someone who is
> > > > just starting out with gtk... Too many things are hidden, and since the
> > > > doc for gtk is so sparse (I do not mean api info, I mean tut's en such)
> > > > glade is not a "good thing"(tm)
> > > >
> > > > Of course, this is my opinion, and I do not expect anybody to agree with
> > > > me. :)
> > > >
> > > > Anset
> > > >
> > > > Bjoern Schiessle wrote:
> > > >
> > > >>Hi,
> > > >>
> > > >>On Sa, 2005-03-26 at 11:00 +0100, Anset wrote:
> > > >>
> > > >>
> > > >>>First of all, when you create a "MyWndow" class, make it enherit
> > > >>>Gtk.Window. Makes your life easier:
> > > >>>
> > > >>>Class MyWindow : Gtk.Window
> > > >>>{
> > > >>>...
> > > >>>}
> > > >>
> > > >>
> > > >>Why should i inherit the MyWindow class from Gtk.Window if i have the
> > > >>whole window already in the glade file? If i do this, than i would have
> > > >>two windows, the window represented by the "MyWindow : Gtk.Window" class
> > > >>and the window i have pulled out of the glade file.
> > > >>
> > > >>If i don't use glade i would inherit MyWindow from Gtk.Window, but if i
> > > >>use glade i would do it like this:
> > > >>
> > > >>class MainWindow {
> > > >>
> > > >>    public static void Main(string[] args) {
> > > >>        Application.Init ();
> > > >>        new MainWindow ();
> > > >>        Application.Run ();
> > > >>    }
> > > >>
> > > >>    public MainWindow () {
> > > >>        Glade.XML gxml = new Glade.XML (null, "app.glade",
> > > >>                                        "MainWindow", null);
> > > >>        gxml.Autoconnect (this);
> > > >>    }
> > > >>    ...
> > > >>}
> > > >>
> > > >>and the second window which i call somewhere from MainWindow with "new
> > > >>SubWindow()":
> > > >>
> > > >>class SubWindow {
> > > >>
> > > >>    public SubWindow () {
> > > >>        Glade.XML gxml = new Glade.XML (null, "app.glade",
> > > >>                                        "SubWindow", null);
> > > >>        gxml.Autoconnect (this);
> > > >>    }
> > > >>    ....
> > > >>}
> > > >>
> > > >>Cheers,
> > > >>Bjoern
> > > >>
> > > >
> > > > _______________________________________________
> > > > Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> > > > http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> > > >
> > > >
> > > _______________________________________________
> > > Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> > > http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> > >
> > 
> > --
> > Rafael "Monoman" Teixeira
> > ---------------------------------------
> > I'm trying to become a "Rosh Gadol" before my own eyes.
> > See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.
> > It hurts!
> > 
> > --
> > No virus found in this incoming message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.308 / Virus Database: 266.8.3 - Release Date: 25/03/2005
> > 
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.308 / Virus Database: 266.8.3 - Release Date: 25/03/2005
> > 
> > _______________________________________________
> > Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> >
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list