> --- Ursprüngliche Nachricht ---
> Von: "Jonathon Jongsma" <[EMAIL PROTECTED]>
> An: "gtkmm-list@gnome.org" <gtkmm-list@gnome.org>
> Betreff: Fwd: pointer of functions - what a confusing things :-)
> Datum: Thu, 9 Mar 2006 09:24:12 -0600
> 
> sorry, forgot to copy this message to this list
> 
> ---------- Forwarded message ----------
> From: Jonathon Jongsma <[EMAIL PROTECTED]>
> Date: Mar 9, 2006 8:01 AM
> Subject: Re: pointer of functions - what a confusing things :-)
> To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> 
> 
> On 3/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Hi,
> > since I was not able to get the Gtk::TreeView working under Windows
> (linker
> > error), I decided to write my own Wrapper for a Gtk+-TreeView-Object.
> > The Event-Handling of my new class MyTreeView should work just like the
> > Event-Handling under Gtkmm.
> > Now I do it like this.
> 
> [snip]
> 
> > The method on_row_activated is not a member-function, and this I think
> is
> > very dirty - but I didnt find a way to give the CALLBACK() a
> > member-function. Isnt there a way to do it like this :
> >
> >  CALLBACK(&MyTreeView::on_row_activated) ?
> >
> > thanks in advance
> >
> > gizmo
> 
> This is what the entire libsigc++ library used by gtkmm solves (i.e.
> sigc::mem_fun(...)).  However, I would highly recommend that you try
> to get TreeView working instead of attempting to re-implement it.
> I've never used gtkmm on windows, but there certainly are people here
> that do.  Perhaps if you posted detailed information about your
> problems using TreeView on windows somebody on the list could help you
> get it working, or maybe we could uncover a bug in gtkmm in the
> process.
> 
> Jonner
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
> 


I have a programm which uses Gtk::TreeView which works fine under Linux.
I tried to compile this programm under Windows and got the linker-error
  
  variable 'vtable for Gtk::TreeViewColumn' can't be auto-imported. Please  
read the documentation for ld's --enable-auto-import for details.

In the forum I found the hint I should link with the option
  -Wl,--enable-runtime-pseudo-reloc
With this option (what ever it means) I could link, but my exe crashed (dont
know why and where), when I tried to execute. Then I started to substitute
the Gtk::TreeView with an GtkTreeView, for which I wrote my own wrapper -
and it worked so far.

But of course its not a clean solution and I would prefer to use the
Gtk::TreeView. I wrote a minimal example with a Gtk::TreeView (listed
below), got the same error "vtable for .....", then added the linker-option
"-W1,--enable ......", could link and surprise, the exe worked.

But then I wanted to go on with this example, just added the line
gtk_rc_parse("./gtkrc") in the main-method, and this was already enough that
my exe crashes again (a message window mentions the libglibmm). Im sure it
must have to do with the linker-option "-Wl,--enable .....", because my
programm, in which I substituted the Gtk::TreeView with an GtkTreeView I
link without that option and everything works fine.

Since Im not that expert when it comes to debug ...... Im lost at this
point.

Here my minimal example which worked.

#include <gtkmm.h>

class TreeViewTest : public Gtk::Window
{
  public:
    TreeViewTest();
    virtual ~TreeViewTest();
  
  protected:  
    Gtk::TreeView m_TreeView;
    Gtk::ScrolledWindow m_ScrolledWindow;
    Glib::RefPtr<Gtk::TreeStore> m_refTreeStore;
    
    class ModelColumns : public Gtk::TreeModelColumnRecord
    {
      public:
        Gtk::TreeModelColumn<std::string> name;
        Gtk::TreeModelColumn<std::string> surname;
    
        ModelColumns();
    };
  
    const ModelColumns m_columns;
};


TreeViewTest::ModelColumns::ModelColumns()
{
  add(name); 
  add(surname);
}


TreeViewTest::TreeViewTest()
{

  m_refTreeStore               = Gtk::TreeStore::create(m_columns);
  
  Gtk::TreeRow row             = *(m_refTreeStore->append());
  row[m_columns.name]          = "Max";
  row[m_columns.surname]       = "Muster"; 
  
  Gtk::TreeRow child_row       = *(m_refTreeStore->append(row.children()));
  child_row[m_columns.name]    = "Moritz";
  child_row[m_columns.surname] = "Muster"; 
  
  m_TreeView.set_model(m_refTreeStore);
  
  m_TreeView.append_column("Name",  m_columns.name);
  m_TreeView.append_column("Surname",  m_columns.surname);
  
  add(m_ScrolledWindow);
  m_ScrolledWindow.add(m_TreeView);
  
  m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
  
  show_all();
}

TreeViewTest::~TreeViewTest() 
{
}

int main(int argc, char **argv) {
  
  Gtk::Main kit(argc, argv);
  //gtk_rc_parse("./gtkrc");
  Gtk::Window *win = new TreeViewTest();
  kit.run(*win);
  delete win;
  return 0;
}

-- 
"Feel free" mit GMX FreeMail!
Monat für Monat 10 FreeSMS inklusive! http://www.gmx.net
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to