[Xfc-dev] A little help

Ricardo M tareasrick at yahoo.com.mx
Thu May 4 17:22:08 CEST 2006


Thank you!
Here's my ListSt.hh code, the header of my new
ListStore class:

#include <xfc/gtk/liststore.hh>

using namespace Xfc;

class listStor : public Gtk::ListStore
{
  int nColumnas;

public:
  listStor (int nCols);
  virtual ~listStor();
};



And the body of the class in file ListStore.cc:

#include <xfc/gtk/liststore.hh>
#include "ListSt.hh"

listStor::listStor (int nCol)
{
  nColumnas = nCol;
  GType types[nCol];

  for (int n=0; n<nCol; ++n)
    types[n] = G_TYPE_STRING;
  set_column_types (nCol, types);
}

listStor::~listStor()
{
}

When i call my class from within another class,
derived from a TreeView is:


  unsigned long nReng, nCols;
  unsigned long i, j;
  String strSQL, strTitulo;
  int nCol;

  set_border_width(2);
  set_policy(Gtk::POLICY_AUTOMATIC,
Gtk::POLICY_AUTOMATIC);
  show();

  connection C("dbname=test user=postgres");
  transaction<> T(C, "trx");
  strSQL = "SELECT vista FROM vistas WHERE tabla='";
  strSQL.append (tabla);
  strSQL.append ("';");
  result R1(T.exec(strSQL.str()));
  nReng = R1.size ();
  if (nReng == 0ul) {
    strSQL = "SELECT * FROM ";
    strSQL.append (tabla);
  } else {
    result::const_iterator c=R1.begin();
    strSQL = "SELECT * FROM ";
    strSQL.append (c["vista"].as(string()));
  }

  result R(T.exec(strSQL.str()));
  nReng = R.size ();
  nCols = R.columns();
  nCol  = R.columns();

  model = new listStor(nCol);

the last line is apparently wher it falls

Thank you

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.yahoo.com.mx/ 



More information about the Xfc-dev mailing list