 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Salvador Huertas Guest
|
Posted: Mon Mar 13, 2006 1:03 pm Post subject: TPropertyEditor Constructor |
|
|
Hi friends,
When compiling a component write in BCBuilder 5 in BDS2006 I get a error
with the parameters of constructor TPropertyEditor. I think that perhpas the
parameter of constructor have change from the version BCBuilder 5, but I
don't find the parameters of constructor in the online help.
Here is my code:
---------------------------------------------------------
//
============================================================================
=
// Fichero de cabecera para el componente07
//
============================================================================
=
#ifndef Componente07H
#define Componente07H
//--------------------------------------------------------------------------
-
#include <SysUtils.hpp>
#include <Controls.hpp>
#include <Classes.hpp>
#include <Forms.hpp>
#include <StdCtrls.hpp>
#include <DesignEditors.hpp>
//--------------------------------------------------------------------------
-
class TDataFieldEditor : public TPropertyEditor
{
protected:
virtual __fastcall TPropertyAttributes GetAttributes(void);
virtual __fastcall AnsiString GetValue(void);
virtual void __fastcall GetValues(TGetStrProc Proc);
virtual void __fastcall SetValue(const AnsiString Value);
public:
// note - TPropertyEditor's constructor has different
// parameters for different BCB versions, so be careful
virtual __fastcall ~TDataFieldEditor(void);
virtual __fastcall TDataFieldEditor(const _di_IFormDesigner ADesigner,
int APropCount);
virtual void __fastcall Activate(void);
};
#endif
----------------------------------------------------------------------------
----------------------
and here the cpp file
**************************************************************************
//
===========================================================================
// Definir un editor de propiedades para el campo DataField
//
===========================================================================
#include <string.h>
#include <classes.hpp>
#include <vcl.h>
#include <treu.h>
#include <DesignEditors.hpp>
#pragma hdrstop
#include "Componente01.h"
#include "Componente02.h"
#include "Componente03.h"
#include "Componente04.h"
#include "Componente05.h"
#include "Componente06.h"
#include "Componente07.h"
#include "Componente08.h"
#include "Componente09.h"
#pragma package(smart_init)
__fastcall TDataFieldEditor::~TDataFieldEditor(void) {
}
__fastcall TDataFieldEditor::TDataFieldEditor(const _di_IFormDesigner
ADesigner, int APropCount)
: TPropertyEditor(ADesigner,APropCount)
{
}
TPropertyAttributes __fastcall TDataFieldEditor::GetAttributes(void)
{
TPropertyAttributes attr = TPropertyEditor::GetAttributes();
TPersistent *punte = GetComponent(0);
if (__classid(TTreuDBEditNumero) == punte->ClassType()) {
TTreuDBEditNumero *pNumero =
dynamic_cast<TTreuDBEditNumero*>(GetComponent(0));
if( (pNumero) && (pNumero->FieldNames->Count > 0) )
attr << paValueList << paSortList;
}
if (__classid(TTreuDBEditFecha) == punte->ClassType()) {
TTreuDBEditFecha *pNumero =
dynamic_cast<TTreuDBEditFecha*>(GetComponent(0));
if( (pNumero) && (pNumero->FieldNames->Count > 0) )
attr << paValueList << paSortList;
}
if (__classid(TTreuDBComboBox) == punte->ClassType()) {
TTreuDBComboBox *pNumero =
dynamic_cast<TTreuDBComboBox*>(GetComponent(0));
if( (pNumero) && (pNumero->FieldNames->Count > 0) )
attr << paValueList << paSortList;
}
if (__classid(TTreuDBLabelNumero) == punte->ClassType()) {
TTreuDBLabelNumero *pNumero =
dynamic_cast<TTreuDBLabelNumero*>(GetComponent(0));
if( (pNumero) && (pNumero->FieldNames->Count > 0) )
attr << paValueList << paSortList;
}
if (__classid(TTreuDBLabelFecha) == punte->ClassType()) {
TTreuDBLabelFecha *pNumero =
dynamic_cast<TTreuDBLabelFecha*>(GetComponent(0));
if( (pNumero) && (pNumero->FieldNames->Count > 0) )
attr << paValueList << paSortList;
}
return attr;
}
AnsiString __fastcall TDataFieldEditor::GetValue(void)
{
return GetStrValue();
}
void __fastcall TDataFieldEditor::GetValues(TGetStrProc Proc)
{
TPersistent *punte = GetComponent(0);
if (__classid(TTreuDBEditNumero) == punte->ClassType()) {
TTreuDBEditNumero *pNumero =
dynamic_cast<TTreuDBEditNumero*>(GetComponent(0));
if( pNumero ) {
TStrings *list = pNumero->FieldNames;
for(int x = 0; x < list->Count; x++)
Proc(list->Strings[x]);
}
}
if (__classid(TTreuDBEditFecha) == punte->ClassType()) {
TTreuDBEditFecha *pNumero =
dynamic_cast<TTreuDBEditFecha*>(GetComponent(0));
if( pNumero ) {
TStrings *list = pNumero->FieldNames;
for(int x = 0; x < list->Count; x++)
Proc(list->Strings[x]);
}
}
if (__classid(TTreuDBComboBox) == punte->ClassType()) {
TTreuDBComboBox *pNumero =
dynamic_cast<TTreuDBComboBox*>(GetComponent(0));
if( pNumero ) {
TStrings *list = pNumero->FieldNames;
for(int x = 0; x < list->Count; x++)
Proc(list->Strings[x]);
}
}
if (__classid(TTreuDBLabelNumero) == punte->ClassType()) {
TTreuDBLabelNumero *pNumero =
dynamic_cast<TTreuDBLabelNumero*>(GetComponent(0));
if( pNumero ) {
TStrings *list = pNumero->FieldNames;
for(int x = 0; x < list->Count; x++)
Proc(list->Strings[x]);
}
}
if (__classid(TTreuDBLabelFecha) == punte->ClassType()) {
TTreuDBLabelFecha *pNumero =
dynamic_cast<TTreuDBLabelFecha*>(GetComponent(0));
if( pNumero ) {
TStrings *list = pNumero->FieldNames;
for(int x = 0; x < list->Count; x++)
Proc(list->Strings[x]);
}
}
}
void __fastcall TDataFieldEditor::SetValue(const AnsiString Value)
{
SetStrValue(Value);
}
//--------------------------------------------------------------------------
-
PTypeInfo AnsiStringTypeInfo()
{
static TTypeInfo typeInfo;
typeInfo.Name = "AnsiString";
typeInfo.Kind = tkLString;
return &typeInfo;
}
//--------------------------------------------------------------------------
-
namespace Componente07
{
void __fastcall PACKAGE Register()
{
RegisterPropertyEditor(AnsiStringTypeInfo(),__classid(TTreuDBEditNumero),
"DataField", __classid(TDataFieldEditor));
RegisterPropertyEditor(AnsiStringTypeInfo(),__classid(TTreuDBEditFecha),
"DataField", __classid(TDataFieldEditor));
RegisterPropertyEditor(AnsiStringTypeInfo(),__classid(TTreuDBComboBox),
"DataField", __classid(TDataFieldEditor));
RegisterPropertyEditor(AnsiStringTypeInfo(),__classid(TTreuDBLabelNumero),
"DataField", __classid(TDataFieldEditor));
RegisterPropertyEditor(AnsiStringTypeInfo(),__classid(TTreuDBLabelFecha),
"DataField", __classid(TDataFieldEditor));
}
}
//--------------------------------------------------------------------------
-
void __fastcall TDataFieldEditor::Activate(void) {
TPersistent *punte = GetComponent(0);
if (__classid(TTreuDBEditNumero) == punte->ClassType()) {
TTreuDBEditNumero *pNumero =
dynamic_cast<TTreuDBEditNumero*>(GetComponent(0));
pNumero->Getcampos();
}
if (__classid(TTreuDBEditFecha) == punte->ClassType()) {
TTreuDBEditFecha *pNumero =
dynamic_cast<TTreuDBEditFecha*>(GetComponent(0));
pNumero->Getcampos();
}
if (__classid(TTreuDBComboBox) == punte->ClassType()) {
TTreuDBComboBox *pNumero =
dynamic_cast<TTreuDBComboBox*>(GetComponent(0));
pNumero->Getcampos();
}
if (__classid(TTreuDBLabelNumero) == punte->ClassType()) {
TTreuDBLabelNumero *pNumero = dynamic_cast<TTreuDBLabelNumero*>(GetCompo
nent(0));
pNumero->Getcampos();
}
if (__classid(TTreuDBLabelFecha) == punte->ClassType()) {
TTreuDBLabelFecha *pNumero =
dynamic_cast<TTreuDBLabelFecha*>(GetComponent(0));
pNumero->Getcampos();
}
TPropertyEditor::Activate();
}
****************************************************************************
************
Thanks in advance!!
Salvador Huertas. |
|
| Back to top |
|
 |
Clayton Arends Guest
|
Posted: Mon Mar 13, 2006 5:03 pm Post subject: Re: TPropertyEditor Constructor |
|
|
The constructor looks okay at first glance. What is the exact error message
you are getting?
- Clayton |
|
| Back to top |
|
 |
Craig Farrell Guest
|
Posted: Tue Mar 14, 2006 2:03 am Post subject: Re: TPropertyEditor Constructor |
|
|
Hi,
I changed the type to Designintf::_di_IDesigner in BCB6 and got farther
until there were other errors.
--Craig |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Mar 14, 2006 3:03 am Post subject: Re: TPropertyEditor Constructor |
|
|
"Craig Farrell" <cNO_SPAM.please.farrell (AT) insprise (DOT) com> wrote in message
news:441613d9$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I changed the type to Designintf::_di_IDesigner in BCB6 and got
farther until there were other errors.
|
Such as?
Gambit |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Mar 14, 2006 3:03 am Post subject: Re: TPropertyEditor Constructor |
|
|
"Clayton Arends" <nospam_claytonarends (AT) hotmail (DOT) com> wrote in message
news:441594d4 (AT) newsgroups (DOT) borland.com...
| Quote: | The constructor looks okay at first glance.
|
It is ok for BCB 5. Not for BCB 6 and BDS 2006.
Gambit |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Mar 14, 2006 3:03 am Post subject: Re: TPropertyEditor Constructor |
|
|
"Salvador Huertas" <none@none> wrote in message
news:44156535 (AT) newsgroups (DOT) borland.com...
| Quote: | When compiling a component write in BCBuilder 5 in BDS2006 I
get a error with the parameters of constructor TPropertyEditor.
|
That is because your parameters are wrong. Borland has changed the
constructor of TPropertyEditor in every version of BCB from 3 to 6. BDS
uses the same parameters that BCB 6 does. The parameters you are trying to
use will not work in BCB 6, and thus will not work in BDS 2006 either.
| Quote: | I think that perhpas the parameter of constructor have change from the
version BCBuilder 5 |
It has.
| Quote: | but I don't find the parameters of constructor in the online help.
|
If you look in DesignEditors.hpp, you will see what the construcctor is
actually declared as.
__fastcall virtual TPropertyEditor(const Designintf::_di_IDesigner
ADesigner, int APropCount);
Gambit |
|
| Back to top |
|
 |
Craig Farrell Guest
|
Posted: Tue Mar 14, 2006 8:03 pm Post subject: Re: TPropertyEditor Constructor |
|
|
| Quote: | farther until there were other errors.
Such as?
|
Sorry, other errors due to the snippit being partial and referring
to types not included in the snippit (i.e. errors not related to
the problem at hand).
--Craig |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|