Thread: [Java-gnome-developer] StatusBar issue + 2 questions
Brought to you by:
afcowie
From: Fred B. <cha...@ma...> - 2004-10-25 02:48:37
|
Hello all I am using the 2.6 libs from debian unstable. I am using eclipse 3.0 for my IDE. Questions first: 1) I have created a Window with glade, and I am tying it in my java code via LibGlade. No problem thus far, except that I don't understand that example (http://cvs.gnome.org/viewcvs/java-gnome/libglade-java/doc/examples/glade/LibGladeTest.java?rev=1.8&view=markup) I have tried it in my own code, but with no success. I have to do something like the following to be able to do something with my widgets: gladeXml = new LibGlade("/home/fblaise/Glade/jgLDAP/jgldap.glade",this); cboExistingConn = (ComboBox)gladeXml.getWidget("cboExistingConn"); If I don't getWidget() my object like this second line shows, despite the fact my widget has the same name in Glade and in my code, I just get a NullPointerException when I invoke anything on it. If anyone can shade some light.. I guess it'd very cool to not manually map each widget, and let LibGlade do it for you. 2) My glade project includes several windows. All my windows pop up when I start the program. Is there anyway to prevent that? 3) The StatusBar problem: When I try to map my status bar like this: statbar1 = (StatusBar)gladeXml.getWidget("statbar1"); It tells me this: could not create widget: org.gnu.gtk.Statusbar Thanks :) fred |
From: Fred B. <cha...@ma...> - 2004-10-25 05:32:22
|
thanks :) 1) yup, I had noticed for the callbacks.. nifty thing. Didn't realize it wouldn't get the whole thing :\ 2) Doh me! I was just getWidget() on the window, then hide() it.. that's better though. 3) I will read up more for the StatusBar. fred ps: copying list. On Mon, 2004-10-25 at 00:36 -0400, Ray Auge wrote: > On Sun, 2004-10-24 at 21:49 -0500, Fred Blaise wrote: > > Hello all > > > > I am using the 2.6 libs from debian unstable. I am using eclipse 3.0 for > > my IDE. > > > > Questions first: > > 1) I have created a Window with glade, and I am tying it in my java code > > via LibGlade. No problem thus far, except that I don't understand that > > example > > (http://cvs.gnome.org/viewcvs/java-gnome/libglade-java/doc/examples/glade/LibGladeTest.java?rev=1.8&view=markup) > > > > I have tried it in my own code, but with no success. I have to do > > something like the following to be able to do something with my widgets: > > > > gladeXml = new LibGlade("/home/fblaise/Glade/jgLDAP/jgldap.glade",this); > > cboExistingConn = (ComboBox)gladeXml.getWidget("cboExistingConn"); > > > > If I don't getWidget() my object like this second line shows, despite > > the fact my widget has the same name in Glade and in my code, I just get > > a NullPointerException when I invoke anything on it. If anyone can shade > > some light.. I guess it'd very cool to not manually map each widget, and > > let LibGlade do it for you. > > I think what is happening in that particular example (and the reason you > don't have any getWidget()s in the code and yet it still works) is that > the glade file used in the example defined the callback functions it > needed and so libglade would auto attach them with those found in the > java code. Now, you still have to getWidget() if you want to do any kind > of widget manipulation cause the only things auto connected are > callbacks (which libglade will complain about if they don't exist in > your code). > > > > > 2) My glade project includes several windows. All my windows pop up when > > I start the program. Is there anyway to prevent that? > > >From glade(-2), for each window, choose the "Common" tab from the > "Properties" window and set "Visible" to "No". From your code you'll > then use the show[All]() and hide() methods on the desired window to ... > you know! > > > > > 3) The StatusBar problem: > > When I try to map my status bar like this: > > > > statbar1 = (StatusBar)gladeXml.getWidget("statbar1"); > > > > It tells me this: > > could not create widget: org.gnu.gtk.Statusbar > > If I recall this one is one of those gnome issues. There are special > "helper" classes for the Appbar, as it's called in libgnome-java, to > help you get the statusbar. I'd suggest reading the libgnome-java > javadocs a couple of times... It took me more than a couple times to get > it the first time... > > > > > Thanks :) > > > > fred > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: IT Product Guide on ITManagersJournal > > Use IT products in your business? Tell us what you think of them. Give us > > Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more > > http://productguide.itmanagersjournal.com/guidepromo.tmpl > > _______________________________________________ > > java-gnome-developer mailing list > > jav...@li... > > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer |
From: Tiago C. <cog...@li...> - 2004-10-25 09:38:27
|
<snip> > > 2) My glade project includes several windows. All my windows pop up when > I start the program. Is there anyway to prevent that? </snip> That's the normal behaviour and a common problem. Set the windows visibility on *glade* to hidden and it should be fixed. |
From: Ray A. <ra...@do...> - 2004-10-25 12:29:13
|
On Sun, 2004-10-24 at 21:49 -0500, Fred Blaise wrote: > Hello all > > I am using the 2.6 libs from debian unstable. I am using eclipse 3.0 for > my IDE. > > Questions first: > 1) I have created a Window with glade, and I am tying it in my java code > via LibGlade. No problem thus far, except that I don't understand that > example > (http://cvs.gnome.org/viewcvs/java-gnome/libglade-java/doc/examples/glade/LibGladeTest.java?rev=1.8&view=markup) > > I have tried it in my own code, but with no success. I have to do > something like the following to be able to do something with my widgets: > > gladeXml = new LibGlade("/home/fblaise/Glade/jgLDAP/jgldap.glade",this); > cboExistingConn = (ComboBox)gladeXml.getWidget("cboExistingConn"); > > If I don't getWidget() my object like this second line shows, despite > the fact my widget has the same name in Glade and in my code, I just get > a NullPointerException when I invoke anything on it. If anyone can shade > some light.. I guess it'd very cool to not manually map each widget, and > let LibGlade do it for you. I think what is happening in that particular example (and the reason you don't have any getWidget()s in the code and yet it still works) is that the glade file used in the example defined the callback functions it needed and so libglade would auto attach them with those found in the java code. Now, you still have to getWidget() if you want to do any kind of widget manipulation cause the only things auto connected are callbacks (which libglade will complain about if they don't exist in your code). > > 2) My glade project includes several windows. All my windows pop up when > I start the program. Is there anyway to prevent that? >From glade(-2), for each window, choose the "Common" tab from the "Properties" window and set "Visible" to "No". From your code you'll then use the show[All]() and hide() methods on the desired window to ... you know! > > 3) The StatusBar problem: > When I try to map my status bar like this: > > statbar1 = (StatusBar)gladeXml.getWidget("statbar1"); > > It tells me this: > could not create widget: org.gnu.gtk.Statusbar If I recall this one is one of those gnome issues. There are special "helper" classes for the Appbar, as it's called in libgnome-java, to help you get the statusbar. I'd suggest reading the libgnome-java javadocs a couple of times... It took me more than a couple times to get it the first time... > > Thanks :) > > fred > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IT Product Guide on ITManagersJournal > Use IT products in your business? Tell us what you think of them. Give us > Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more > http://productguide.itmanagersjournal.com/guidepromo.tmpl > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer -- Ray Auge <ra...@do...> |
From: Mark H. <mh...@ti...> - 2004-10-25 18:50:52
|
On Sun, Oct 24, 2004 at 09:49:07PM -0500, Fred Blaise wrote: > Questions first: > 1) I have created a Window with glade, and I am tying it in my java code > via LibGlade. No problem thus far, except that I don't understand that > example > (http://cvs.gnome.org/viewcvs/java-gnome/libglade-java/doc/examples/glade/LibGladeTest.java?rev=1.8&view=markup) > > I have tried it in my own code, but with no success. I have to do > something like the following to be able to do something with my widgets: > > gladeXml = new LibGlade("/home/fblaise/Glade/jgLDAP/jgldap.glade",this); > cboExistingConn = (ComboBox)gladeXml.getWidget("cboExistingConn"); I'm not quite sure what you mean by this? Are you saying that the example doesn't work unless you have a call to getWidget in the code (even if you don't use it)? -- .''`. Mark Howard : :' : `. `' http://www.tildemh.com `- mh...@de... | mh...@ti... |
From: Fred B. <cha...@ma...> - 2004-10-25 22:40:38
|
I think it works as design. The callbacks I define in Glade are brought on when I 'new LibGlade()'. However, from the example below, if i was to do a cboExistingConn.getActive() without prior doing a getWidget() on the ComboBox, then it would fail with a NullPointerException. So, I think this is the way it should be? Thanks fred On Mon, 2004-10-25 at 19:50 +0100, Mark Howard wrote: > On Sun, Oct 24, 2004 at 09:49:07PM -0500, Fred Blaise wrote: > > Questions first: > > 1) I have created a Window with glade, and I am tying it in my java code > > via LibGlade. No problem thus far, except that I don't understand that > > example > > (http://cvs.gnome.org/viewcvs/java-gnome/libglade-java/doc/examples/glade/LibGladeTest.java?rev=1.8&view=markup) > > > > I have tried it in my own code, but with no success. I have to do > > something like the following to be able to do something with my widgets: > > > > gladeXml = new LibGlade("/home/fblaise/Glade/jgLDAP/jgldap.glade",this); > > cboExistingConn = (ComboBox)gladeXml.getWidget("cboExistingConn"); > > I'm not quite sure what you mean by this? Are you saying that the example > doesn't work unless you have a call to getWidget in the code (even if you don't > use it)? > |
From: Mark H. <mh...@ti...> - 2004-10-26 17:40:33
|
On Mon, Oct 25, 2004 at 05:40:57PM -0500, Fred Blaise wrote: > I think it works as design. The callbacks I define in Glade are brought > on when I 'new LibGlade()'. > However, from the example below, if i was to do a > cboExistingConn.getActive() without prior doing a getWidget() on the > ComboBox, then it would fail with a NullPointerException. > > So, I think this is the way it should be? Yes, libglade-java only uses reflection to map signal handlers. It doesn't look for variables with names and types matching widgets and update them -- .''`. Mark Howard : :' : `. `' http://www.tildemh.com `- mh...@de... | mh...@ti... |
From: Andrew C. <an...@op...> - 2004-10-26 22:33:20
|
On Tue, 2004-10-26 at 18:40 +0100, Mark Howard wrote: > Yes, libglade-java only uses reflection to map signal handlers. It doesn'= t look > for variables with names and types matching widgets and update them However, if we are able to complete an effort along the lines of what Jerry has been suggesting, to make a Java mapping directly to GObject, and make it extensible, then WOW what magic we could work with LibGlade. AfC Toronto |