reorderable treeview question
- From: Ferenc Gerlits <fgerlits gmail com>
- To: gtk-app-devel-list gnome org
- Subject: reorderable treeview question
- Date: Tue, 14 Aug 2007 18:54:59 +0200
Hi,
I am using libglade (gtkmm 2.10.8 and libglademm 2.6.3, on Ubuntu
Feisty), and I have a problem with reorderable treeviews.
When I try to grab a row and move it within the GtkTreeView, it does
nothing. If I first drag the row outside the GtkTreeView widget, and
then drag it back in, it works as expected (shows the drop target, and
moves the row there when I drop it).
Does anybody know why this happens, and how to fix it? A test case is
attached below.
Ferenc
-----------------------------------------------------------------------
TestWindow.cpp
-----------------------------------------------------------------------
// compile with
// g++ `pkg-config --cflags --libs libglademm-2.4` TestWindow.cpp
#include <gtkmm.h>
#include <libglademm.h>
class TestWindow
{
private:
class ModelColumns : public Gtk::TreeModelColumnRecord
{
public:
Gtk::TreeModelColumn<Glib::ustring> textColumn;
ModelColumns (void)
{
add(textColumn);
}
};
ModelColumns modelColumns;
Glib::RefPtr<Gtk::ListStore> treeModel;
Gtk::TreeView * treeView;
public:
Gtk::Window * window;
TestWindow (void)
{
Glib::RefPtr<Gnome::Glade::Xml> glade;
glade = Gnome::Glade::Xml::create("TestWindow.glade");
glade->get_widget("window1", window);
treeModel = Gtk::ListStore::create(modelColumns);
glade->get_widget("treeview1", treeView);
treeView->set_model(treeModel);
treeView->append_column("title", modelColumns.textColumn);
Gtk::TreeModel::Row row = *treeModel->append();
row[modelColumns.textColumn] = "1";
row = *treeModel->append();
row[modelColumns.textColumn] = "2";
row = *treeModel->append();
row[modelColumns.textColumn] = "3";
row = *treeModel->append();
row[modelColumns.textColumn] = "4";
}
};
int
main (int argc,
char * argv[])
{
Gtk::Main kit(argc, argv);
TestWindow testWindow;
Gtk::Main::run(*testWindow.window);
}
-----------------------------------------------------------------------
TestWindow.glade
-----------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.2.0 on Tue Aug 14 17:23:56 2007 by
fgerlits desktop-->
<glade-interface>
<widget class="GtkWindow" id="window1">
<property name="width_request">300</property>
<property name="height_request">300</property>
<property name="events">GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkTreeView" id="treeview1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK</property>
<property name="headers_clickable">True</property>
<property name="reorderable">True</property>
<property name="rules_hint">True</property>
</widget>
</child>
</widget>
</glade-interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]