🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.upgrade
1 messages
1 total messages Started by Liu Shan Thu, 19 Jan 2006 07:10
class not found in BCB6
#464
Author: Liu Shan
Date: Thu, 19 Jan 2006 07:10
508 lines
16422 bytes
Hi, Everybody,

I'd like to ask some question about self-created component work in BCB4 and 
BCB6.

I created a few components in bcb4,compiled it and installed in BCB4, no 
problem. later I create a app and drap-drop this component on a form and 
built my app, no problem, it worked find.

I try to upgrate this app to BCB6, I have to recompile this component in 
BCB6, the way I did is, create a new package, name it same as that in BCB4, 
add all files in bcb4 in it, compile it and installed in BCB6, no problem. 
In bcb6, built my APP that come from BCB4, no problem, but when I run app, 
it always told me "class TiTETTable not fund".

here is my code for your reference


//---------------------------------------------------------------------------
#ifndef iTETTableH
#define iTETTableH
//---------------------------------------------------------------------------
#include <SysUtils.hpp>
#include <Controls.hpp>
#include <Classes.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
#include "iTETAutoBlk.h"
//---------------------------------------------------------------------------
enum TiTETTableLabelTypes { iTETlb_Digits, iTETlb_Letters};
//---------------------------------------------------------------------------
class PACKAGE TiTETTable : public TPanel
{
private:
    int FLeftGap;
    int FRightGap;
    int FTopGap;
    int FBottomGap;
    int FXSize;
    int FYSize;
    int FLineWidth;
    TColor FLineColor;
    TColor FTableColor;
    bool FDrawPicture;
    bool FStretchDrawPicture;
    bool FDrawLabel;

    TiTETTableLabelTypes FXLabelType,FYLabelType;

 void __fastcall SetLeftGap(int Value);
 void __fastcall SetRightGap(int Value);
 void __fastcall SetTopGap(int Value);
 void __fastcall SetBottomGap(int Value);

 void __fastcall SetXSize(int Value);
 void __fastcall SetYSize(int Value);

 void __fastcall SetLineWidth(int Value);
 void __fastcall SetLineColor(TColor Value);
 void __fastcall SetTableColor(TColor Value);

 void __fastcall SetXLabelType(TiTETTableLabelTypes Value);
 void __fastcall SetYLabelType(TiTETTableLabelTypes Value);

    TiTETTableLabelTypes __fastcall CheckLableType(TiTETTableLabelTypes 
Value);
    AnsiString __fastcall GetLabel(TiTETTableLabelTypes type,int i);

 void __fastcall SetDrawPicture(bool Value);
    void __fastcall SetStretchDrawPicture(bool Value);
 void __fastcall SetDrawLabel(bool Value);

    int FAutoBlkCount;
    TiTETAutoBlk **AuotoBlkList;
    bool bLighting;

protected:
 virtual void __fastcall Paint(void);

public:
     __fastcall TiTETTable(TComponent* Owner);
    __fastcall ~TiTETTable(void);

    void __fastcall UpdateHighLight(void);
    void __fastcall SetHighLight(int i,bool,TColor );
    void __fastcall SetAllHighLight(bool bHighLight,TColor);

    void __fastcall SetHighLight(int i,bool 
bHighLight){SetHighLight(i,bHighLight,DEFAULT_HIGHLIGHT_COLOR);};
    void __fastcall SetAllHighLight(bool 
bHighLight){SetAllHighLight(bHighLight,DEFAULT_HIGHLIGHT_COLOR);};

    int __fastcall SetAuotoBlkList(int n);
    void __fastcall ClearAuotoBlkList(void);
    TiTETAutoBlk* __fastcall GetiTETAutoBlk(int i);
    int GetAuotoBlkCount(){return FAutoBlkCount;};

__published:
 __property int LeftGap = {read=FLeftGap, write=SetLeftGap, default=10};
 __property int RightGap = {read=FRightGap, write=SetRightGap, default=1};
 __property int TopGap = {read=FTopGap, write=SetTopGap, default=10};
 __property int BottomGap = {read=FBottomGap, write=SetBottomGap, 
default=1};

 __property int XSize = {read=FXSize, write=SetXSize, default=10};
 __property int YSize = {read=FYSize, write=SetYSize, default=10};

 __property int LineWidth = {read=FLineWidth, write=SetLineWidth, 
default=2};
 __property TColor LineColor = {read=FLineColor, write=SetLineColor, 
default=clBtnShadow};
 __property TColor TableColor = {read=FTableColor, write=SetTableColor, 
default=clBtnFace};

 __property TiTETTableLabelTypes XLabelType = {read=FXLabelType, 
write=SetXLabelType, default=iTETlb_Digits};
 __property TiTETTableLabelTypes YLabelType = {read=FYLabelType, 
write=SetYLabelType, default=iTETlb_Letters};
 __property bool DrawPicture = {read=FDrawPicture, write=SetDrawPicture, 
default=true};
 __property bool StretchDrawPicture = {read=FStretchDrawPicture, 
write=SetStretchDrawPicture, default=true};
 __property bool DrawLabel = {read=FDrawLabel, write=SetDrawLabel, 
default=true};


};
//---------------------------------------------------------------------------
#endif



//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "iTETTable.h"
//---------------------------------------------------------------------------
USERES("iTETTable.dcr");
#pragma package(smart_init)
//---------------------------------------------------------------------------
// ValidCtrCheck is used to assure that the components created do not have
// any pure virtual functions.
//

static inline void ValidCtrCheck(TiTETTable *)
{
    new TiTETTable(NULL);
}
//---------------------------------------------------------------------------
__fastcall TiTETTable::TiTETTable(TComponent* Owner)
    : TPanel(Owner)
{
    FLeftGap=20;
    FRightGap=1;
    FTopGap=20;
    FBottomGap=1;

    FXSize=10;
    FYSize=10;

    FLineWidth=2;
    FLineColor=clBtnShadow;

    Color=clBtnShadow;
    FTableColor=clBtnFace;

    FXLabelType=iTETlb_Digits;
    FYLabelType=iTETlb_Letters;

    FAutoBlkCount=0;

    AuotoBlkList=NULL;
    FDrawPicture=true;
    FStretchDrawPicture=true;
    FDrawLabel=true;
    bLighting=false;

}
//---------------------------------------------------------------------------
__fastcall TiTETTable::~TiTETTable(void)
{
    ClearAuotoBlkList();
}
//---------------------------------------------------------------------------
namespace Itettable
{
    void __fastcall PACKAGE Register()
    {
         TComponentClass classes[1] = {__classid(TiTETTable)};
         RegisterComponents("MxcComponents", classes, 0);
    }
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::SetLeftGap(int Value)
{
    if(FLeftGap!=Value){
        FLeftGap=Value;
        Repaint();
    }
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::SetRightGap(int Value)
{
    if(FRightGap!=Value){
        FRightGap=Value;
        Repaint();
    }
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::SetTopGap(int Value)
{
    if(FTopGap!=Value){
        FTopGap=Value;
        Repaint();
    }
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::SetBottomGap(int Value)
{
    if(FBottomGap!=Value){
        FBottomGap=Value;
        Repaint();
    }
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::SetXSize(int Value)
{
    if(FXSize!=Value){
        FXSize=Value;
        Repaint();
    }
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::SetYSize(int Value)
{
    if(FYSize!=Value){
        FYSize=Value;
        Repaint();
    }
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::SetLineWidth(int Value)
{
    if(FLineWidth!=Value){
        FLineWidth=Value;
        Repaint();
    }
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::SetLineColor(TColor Value)
{
    if(FLineColor!=Value){
        FLineColor=Value;
        Repaint();
    }
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::SetTableColor(TColor Value)
{
    if(FTableColor!=Value){
        FTableColor=Value;
        Repaint();
    }
}
//---------------------------------------------------------------------------
TiTETTableLabelTypes __fastcall 
TiTETTable::CheckLableType(TiTETTableLabelTypes Value)
{
    if(Value==iTETlb_Letters){
        if(FXSize>52){
            Value=iTETlb_Digits;
        }
    }
    return Value;
}
//---------------------------------------------------------------------------
AnsiString __fastcall TiTETTable::GetLabel(TiTETTableLabelTypes type,int i)
{
    if(type==iTETlb_Digits) return i+1;
    AnsiString as="A";
    if(i<26) as[1]=BYTE('A'+i);
    else if(i<52) {
         as[1]=BYTE('a'+i-26);
    }else
        as=AnsiString(i+1);

    return as;
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::SetXLabelType(TiTETTableLabelTypes Value)
{
    Value=CheckLableType(Value);
    if(FXLabelType!=Value){
        FXLabelType=Value;
        Repaint();
    }
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::SetYLabelType(TiTETTableLabelTypes Value)
{
    Value=CheckLableType(Value);
    if(FYLabelType!=Value){
        FYLabelType=Value;
        Repaint();
    }
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::SetDrawPicture(bool Value)
{
    if(FDrawPicture!=Value){
       FDrawPicture=Value;
       for(int i=0;i<FAutoBlkCount;i++){
            AuotoBlkList[i]->DrawPicture=FDrawPicture;
       }
    }
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::SetStretchDrawPicture(bool Value)
{
    if(FStretchDrawPicture!=Value){
       FStretchDrawPicture=Value;
       for(int i=0;i<FAutoBlkCount;i++){
            AuotoBlkList[i]->StretchDrawPicture=FStretchDrawPicture;
       }
    }
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::SetDrawLabel(bool Value)
{
    if(FDrawLabel!=Value){
       FDrawLabel=Value;
       for(int i=0;i<FAutoBlkCount;i++){
            AuotoBlkList[i]->DrawLabel=FDrawLabel;
       }
    }
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::Paint(void)
{
   //TPanel::Paint();

   Canvas->Font=Font;
   Canvas->Brush->Style = bsClear;
   Canvas->Brush->Color = Color;
   TRect rect = TRect(BevelWidth, BevelWidth, Width-BevelWidth, 
Height-BevelWidth);
   Canvas->FillRect(rect);

   rect.Top+=FTopGap;
   rect.Left+=FLeftGap;
   rect.Right-=FRightGap;
   rect.Bottom-=FBottomGap;

   int nx=(rect.Right-rect.Left)/FXSize;//+0.5;
   int ny=(rect.Bottom-rect.Top)/FYSize;//+0.5;

   rect.Right=rect.Left+nx*FXSize;
   rect.Bottom=rect.Top+ny*FYSize;

   Canvas->Brush->Color = FTableColor;
   Canvas->FillRect(rect);
   Canvas->Brush->Style = bsClear;

   int i,x,y;
   TRect rlb;
   int lw,lh;
   AnsiString as;

   Canvas->Pen->Width=FLineWidth;
   Canvas->Pen->Color=FLineColor;

   for(i=0;i<FXSize;i++){
       x=rect.Left+i*nx;
       Canvas->MoveTo(x,rect.Top);
       Canvas->LineTo(x,rect.Bottom);

       as=GetLabel(FXLabelType,i);
       lw=Canvas->TextWidth(as);
       lh=Canvas->TextHeight(as);
       x+=nx/2;
       y=rect.Top-FTopGap/2;

       rlb=TRect(x-lw/2,y-lh/2,x+lw/2,y+lh/2);
       DrawText(Canvas->Handle, as.c_str(), -1, &rlb,
                 DT_NOCLIP|DT_CENTER | DT_VCENTER |DT_SINGLELINE | 
DrawTextBiDiModeFlags(0) );

   }
   Canvas->MoveTo(rect.Right,rect.Top);
   Canvas->LineTo(rect.Right,rect.Bottom);

   for(i=0;i<FYSize;i++){
       y=rect.Top+i*ny;
       Canvas->MoveTo(rect.Left,y);
       Canvas->LineTo(rect.Right,y);

       as=GetLabel(FYLabelType,i);

       y+=ny/2;
       x=rect.Left-FLeftGap/2;

       lw=Canvas->TextWidth(as);
       lh=Canvas->TextHeight(as);

       rlb=TRect(x-lw/2,y-lh/2,x+lw/2,y+lh/2);
       DrawText(Canvas->Handle, as.c_str(), -1, &rlb,
                 DT_NOCLIP|DT_CENTER | DT_VCENTER |DT_SINGLELINE | 
DrawTextBiDiModeFlags(0) );


   }

   Canvas->MoveTo(rect.Left,rect.Bottom);
   Canvas->LineTo(rect.Right,rect.Bottom);


   for(i=0;i<FAutoBlkCount;i++){
        AuotoBlkList[i]->Width=nx*AuotoBlkList[i]->XSize;
        AuotoBlkList[i]->Height=ny*AuotoBlkList[i]->YSize;
        AuotoBlkList[i]->Left=FLeftGap+BevelWidth+nx*(AuotoBlkList[i]->X-1);
        AuotoBlkList[i]->Top=FTopGap+BevelWidth+ny*(AuotoBlkList[i]->Y-1);
        //AuotoBlkList[i]->HighLigtPaint();
   }

}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::UpdateHighLight(void)
{
   if(!Visible) return;

   for(int i=0;i<FAutoBlkCount;i++){
        if(AuotoBlkList[i]->HighLight)
            AuotoBlkList[i]->HighLigtPaint(bLighting);
   }

   bLighting=!bLighting;
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::SetAllHighLight(bool bHighLight,TColor color)
{
   for(int i=0;i<FAutoBlkCount;i++){
        AuotoBlkList[i]->HighLightColor=color;
        AuotoBlkList[i]->HighLight=bHighLight;
   }
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::SetHighLight(int i,bool bHightLight,TColor 
color)
{
   if(i<0||i>=FAutoBlkCount) return;
   AuotoBlkList[i]->HighLightColor=color;
   AuotoBlkList[i]->HighLight=bHightLight;
   //Repaint();
}
//---------------------------------------------------------------------------
void __fastcall TiTETTable::ClearAuotoBlkList(void)
{
    if(AuotoBlkList){
        for(int i=0;i<FAutoBlkCount;i++){
           delete AuotoBlkList[i];
           AuotoBlkList[i]=NULL;
        }
       free(AuotoBlkList);
       AuotoBlkList=NULL;
    }
    FAutoBlkCount=0;

}
//---------------------------------------------------------------------------
int __fastcall TiTETTable::SetAuotoBlkList(int n)
{
    if(n<=0) ClearAuotoBlkList();
    else{
       if(n!=FAutoBlkCount){
          for(int i=n;i<FAutoBlkCount;i++){
              delete AuotoBlkList[i];
              AuotoBlkList[i]=NULL;
          }

          int size=n*sizeof(TiTETAutoBlk *);
          TiTETAutoBlk **NewAutoBlkList=(TiTETAutoBlk 
**)realloc(AuotoBlkList,size);
          if(NewAutoBlkList){
              AuotoBlkList=NewAutoBlkList;
              for(int i=FAutoBlkCount;i<n;i++){
                  AuotoBlkList[i]=new TiTETAutoBlk(this);
                  AuotoBlkList[i]->DrawPicture=FDrawPicture;
                  AuotoBlkList[i]->DrawLabel=FDrawLabel;
                  AuotoBlkList[i]->StretchDrawPicture=FStretchDrawPicture;
                  AuotoBlkList[i]->ConIdx=i;
              }
              FAutoBlkCount=n;
              Repaint();
          };
       }
    }
    return FAutoBlkCount;

}
//---------------------------------------------------------------------------
TiTETAutoBlk* __fastcall TiTETTable::GetiTETAutoBlk(int i)
{
   if(i<0||i>=FAutoBlkCount) return NULL;
   return AuotoBlkList[i];
}
//---------------------------------------------------------------------------
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads