Hi!

I have a problem with the TreeView and Glade

I'm using:
libjava-gnome 4.0.14
Glade 3.6.7
Eclipse 3.6.1
Ubuntu 10.04

For example, in the next code, where I don't use glade, the TreeView show
the information of TreeModel
---------------8<---------------------
public class ExampleWithoutGlade {
    public ExampleWithoutGlade() {
     Window win = new Window();
        DataColumnString placeName = new DataColumnString();
        ListStore model = new ListStore(new DataColumn[] { placeName });

        TreeIter row = model.appendRow();
        model.setValue(row, placeName, "Line 1");
        row = model.appendRow();
        model.setValue(row, placeName, "Line 2");
        row = model.appendRow();
        model.setValue(row, placeName, "Line 3");

        TreeView treeview = new TreeView(model);
 win.add(treeview);
        TreeViewColumn vertical = treeview.appendColumn();
        vertical.setTitle("Lines");
        CellRendererText renderer = new CellRendererText(vertical);
        renderer.setMarkup(placeName);

        win.showAll();

        win.connect(new Window.DeleteEvent() {
            public boolean onDeleteEvent(Widget source, Event event) {
                Gtk.mainQuit();
                return false;
            }
        });
    }

    public static void main(String[] args) {
        Gtk.init(args);
        new ExampleWithoutGlade();
        Gtk.main();
    }
}
----------------------------------------

However, when I use the Glade interface, the TreeView doesn't show with the
information of TreeModel
---------------8<---------------------
public class ExampleWithGlade {
    public ExampleWithGlade() throws FileNotFoundException {
     XML xmlWin = Glade.parse("rsc/example.glade", "win");
     XML xmlTreeView = Glade.parse("rsc/example.glade", "treeview");

     Window win = (Window) xmlWin.getWidget("win");
     TreeView treeview = (TreeView) xmlTreeView.getWidget("treeview");

        DataColumnString placeName = new DataColumnString();
        ListStore model = new ListStore(new DataColumn[] { placeName });

        TreeIter row = model.appendRow();
        model.setValue(row, placeName, "Line 1");
        row = model.appendRow();
        model.setValue(row, placeName, "Line 2");
        row = model.appendRow();
        model.setValue(row, placeName, "Line 3");

        treeview.setModel(model);
         TreeViewColumn vertical = treeview.appendColumn();
        vertical.setTitle("Lines");
        CellRendererText renderer = new CellRendererText(vertical);
        renderer.setMarkup(placeName);

        win.showAll();

        win.connect(new Window.DeleteEvent() {
            public boolean onDeleteEvent(Widget source, Event event) {
                Gtk.mainQuit();
                return false;
            }
        });
    }

    public static void main(String[] args) throws FileNotFoundException {
        Gtk.init(args);
        new ExampleWithGlade();
        Gtk.main();
    }
}
----------------------------------------

The glade file:
Preferences: libglade + gtk+ 2.12
---------------8<---------------------
<?xml version="1.0"?>
<glade-interface>
  <!-- interface-requires gtk+ 2.12 -->
  <!-- interface-naming-policy project-wide -->
  <widget class="GtkWindow" id="win">
    <property name="title" translatable="yes">.</property>
    <child>
      <widget class="GtkTreeView" id="treeview">
        <property name="visible">True</property>
        <property name="can_focus">True</property>
      </widget>
    </child>
  </widget>
</glade-interface>
----------------------------------------

I don't undestand the reason of this issue.
Could you help me?

Best regards
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
java-gnome-developer mailing list
java-gnome-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/java-gnome-developer

Reply via email to