Need a help

From: devinim.solen@tde.alstom.com
Date: Wed Mar 17 1999 - 08:05:41 MET


Dear CINT users;

     Here is my source; and the problem is I get an error, when I call void
BuildCurrencyListCtrl(CChDatabase* p1, CChListCtrl* p2) function from my
application as follows;



Error
--------------------------------------------------------------------------------

D:\Projects\Script>cint CurrencyListDialog.cpp
Error: No symbol CChCurrencyListCtrl in current scope
FILE:\Projects\Script\ChCurrencyListCtrl.cpp LINE:130
!!!Error recovered!!!


void BuildCurrencyListCtrl(CChDatabase* p1, CChListCtrl* p2)
{
     CChCurrencyListCtrl c(p1, p2); ----------------------> this lines occurs
this error.

     c.Build();
}



Application
--------------------------------------------------------------------------------

void CCurrencyListCtrl::Build()
{
     CString   Command;

     /*
     Command.Format(_T("\
          { \
               CChCurrencyListCtrl CurrencyListCtrl((CChDatabase*) %lu,
(CChListCtrl*) %lu); \
               \
               CurrencyListCtrl.Build();\
          }"), m_pDatabase, this);
     */

     Command.Format(_T("BuildCurrencyListCtrl((CChDatabase*) %lu, (CChListCtrl*)
 %lu)"), m_pDatabase, this);

     G__loadfile("\\Projects\\Script\\ChCurrencyListCtrl.cpp");
     G__calc((char*) (LPCTSTR) Command);
}



Script header source.
--------------------------------------------------------------------------------

#pragma includepath "\Projects\Debug\Bin"
#pragma includepath "\Projects\ChDatabase"
#pragma includepath "\Projects\Accountant\Currency"

#include "String.cpp"
#include <ChDatabase.dll>
#include <ChWinLib.dll>
#include <Currency.dll>
#include <CurrencyBusinessLogic.dll>

class CChCurrencyListCtrl
{
public:
     CChCurrencyListCtrl(CChDatabase* pDatabase);
     CChCurrencyListCtrl(CChDatabase* pDatabase, CChListCtrl* pListCtrl);
     ~CChCurrencyListCtrl();

     virtual   BOOL OnCommand(WPARAM wParam, LPARAM lParam);
     virtual   void OnLButtonDown(UINT nFlags, CChPoint point);
     virtual   void OnRButtonDown(UINT nFlags, CChPoint point);

     int       InsertItem(int nItem, CString strItem);
     int       InsertColumn(int nCol, CString ColumnHeading);
     int       DeleteAllItems();
     int       SetColumnWidth(int nCol, int cx);

          void OnRefresh();
     virtual   void Build();

private:
     CChDatabase*        m_pDatabase;
     CCurrencyListCtrl*  m_pListCtrl;
};


Source.
--------------------------------------------------------------------------------

#include "ChCurrencyListCtrl.h"



CChCurrencyListCtrl::CChCurrencyListCtrl(CChDatabase* pDatabase)
{
     m_pDatabase = pDatabase;
     m_pListCtrl = new CCurrencyListCtrl;
}

CChCurrencyListCtrl::CChCurrencyListCtrl(CChDatabase* pDatabase, CChListCtrl*
pListCtrl)
{
     m_pDatabase = pDatabase;
     m_pListCtrl = pListCtrl;
}

CChCurrencyListCtrl::~CChCurrencyListCtrl()
{
     if (m_pListCtrl)
          delete m_pListCtrl;
}

int  CChCurrencyListCtrl::InsertItem(int nItem, CString strItem)
{
     return m_pListCtrl->InsertItem(nItem, strItem);
}

int CChCurrencyListCtrl::InsertColumn(int nCol, CString ColumnHeading)
{
     return m_pListCtrl->InsertColumn(nCol, ColumnHeading);
}

int CChCurrencyListCtrl::DeleteAllItems()
{
     return m_pListCtrl->DeleteAllItems();
}

int CChCurrencyListCtrl::SetColumnWidth(int nCol, int cx)
{
     return m_pListCtrl->SetColumnWidth(nCol, cx);
}

BOOL CCurrencyListCtrl::OnCommand(WPARAM wParam, LPARAM lParam)
{
     printf("Command:%lu %lu\n", wParam, lParam);

     switch(wParam)
     {
     case MF_CURRENCYLISTCTRL_ADD:
          {
               CChCurrencyDialog(m_pChDatabase).DoModal();
          }
          break;
     case MF_CURRENCYLISTCTRL_EDIT:
          //OnEdit();
          break;
     case MF_CURRENCYLISTCTRL_DELETE:
          //OnDelete();
          break;
     case MF_CURRENCYLISTCTRL_REFRESH:
               OnRefresh();
          break;
     };
     return TRUE;
}

void CCurrencyListCtrl::OnLButtonDown(UINT nFlags, CChPoint point)
{
}

void CCurrencyListCtrl::OnRButtonDown(UINT nFlags, CChPoint point)
{
     CChMenu   Menu;

     Menu.CreatePopupMenu();

     Menu.InsertMenu(-1, 0, 1, "Add");
     Menu.InsertMenu(-1, 0, 2, "Edit");
     Menu.InsertMenu(-1, 0, 3, "Delete");
     Menu.InsertMenu(-1, MF_SEPARATOR, 0); // ???
     Menu.InsertMenu(-1, 0, 4, "Refresh");
     //Menu.InsertMenu(UNIT nPosition, UINT nFlags, UINT nIDNewItem,LPCTSTR
lpszNewItem);

     ClientToScreen(&point);

     Menu.TrackPopupMenu(0, point.x, point.y, this);
}

void CChCurrencyListCtrl::OnRefresh()
{
     CCurrencyViewRecordset   Set(m_pDatabase);

     Set.Open();

     DeleteAllItems();

     while (!Set.IsEOF())
     {
          InsertItem(0, Set.m_Symbol);
          Set.MoveNext();
     }

     Set.Close();
}

void CChCurrencyListCtrl::Build()
{
     InsertColumn(0, "Symbol");
     SetColumnWidth(0, 54);

     InsertColumn(1, "Name");
     SetColumnWidth(1, 115);

     OnRefresh();
}

void BuildCurrencyListCtrl(CChDatabase* p1, CChListCtrl* p2)
{
     CChCurrencyListCtrl c(p1, p2);

     c.Build();
}



Thanks.

Devinim SOLEN



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:30 MET