RE: [Java-gnome-developer] Beginner problems.
Brought to you by:
afcowie
From: Jeffrey M. <Jef...@Br...> - 2002-02-14 18:16:00
|
Nic, Are you using the code in CVS? There are a number of problems with the code that is currently in CVS. I am about 80% complete with a port to GTK/GNOME 2 and haven't updated any of the examples or the tutorial to the latest API. The tutorial and all of the examples included with the latest release work fine on my systems (including the proper handling of the close event). What version of GTK and GNOME are you using? -Jeff > > Hullo. > > I'm just going through some of your examples, learning about GTK > and Gnome programming. > > The first thing I tried out didn't work! Here's my (not very different > from your tutorial) test class: > > public class Toy > { > > private GnomeApp app = null; > > public static final String appVersion = "0.1"; > > public Toy() > { > createMainWindow(); > } > > private void createMainWindow() > { > app = new GnomeApp("Toy", "Toy App"); > app.setPolicy(false, true, false); > app.setWmclass("Toy", "ToyApp"); > app.setUsize(200, 200); > app.signalConnect("delete_event", this); > app.signalConnect("destroy", "mainQuit", Gtk.class); > > GtkAlignment alignment = new GtkAlignment(1.0, 0.5, > 0.15, 0.15); > GtkButton button = new GtkButton("The Button Label"); > alignment.add(button); > app.add(allignment); > > app.showAll(); > } > > public boolean delete_event(GdkEvent evnt) > { > return true; > } > > public static void main(String[] args) > { > Gnome.init("Toy", Toy.appVersion, args.length, args); > Toy toy = new Toy(); > Gtk.main(); > } > > } > > It has 2 problems: > > The first problem is that the window manager close event doesn't seem > to get handled. I'm not sure why, none of the GnomeApp examples in > your tutorial seem to handle close events properly. > > The second problem is one of my understanding I expect. I thought I > would be able to add the alignment to the GnomeApp, GnomeApp is a > GtkWindow so it looked like it made sense. When I run the code > however I get this: > > Gtk-CRITICAL **: file gtkcontainer.c: line 715 > (gtk_container_add): assertion `widget->parent == NULL' failed > > and no button (the window still pops up though). > > > Can anyone explain what I'm doing wrong? If you do maybe I can help > patch the tutorial. > > > > Nic > > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer > |