BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

deriving from TPropertyEditor

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
ScOe
Guest





PostPosted: Tue Jul 20, 2004 10:43 am    Post subject: deriving from TPropertyEditor Reply with quote



I have problem writing my property editor derived class. I get error that
compiler could not find a match for 'TPropertyEditor::TPropertyEditor ()'
I saw same class struct in 'Example: Property editor class'


My code:
class PACKAGE aSetFieldPropEditor: public TPropertyEditor
{
public:
__fastcall aSetFieldPropEditor(void) : Dsgnintf::TPropertyEditor() {};


Back to top
Todd Brylski
Guest





PostPosted: Tue Jul 20, 2004 5:02 pm    Post subject: Re: deriving from TPropertyEditor Reply with quote



The Compiler is telling you correctly, there is no TPropertyEditor
constructor that takes no paramaters. This is the only constructor defined:

__fastcall TPropertyEditor(const _di_IFormDesigner ADesigner, int APropCount);

This is in the help file. You need to use the help in order to make your
programs correct. This is the way to use it:

__fastcall aSetFieldPropEditor::aSetFieldPropEditor(const _di_IFormDesigner ADesigner, int APropCount)
: TPropertyEditor( ADesigner, APropCount )
{
}

Todd

"ScOe" <cbinders (AT) hotmail (DOT) com> wrote

Quote:
I have problem writing my property editor derived class. I get error that
compiler could not find a match for 'TPropertyEditor::TPropertyEditor ()'
I saw same class struct in 'Example: Property editor class'

My code:
class PACKAGE aSetFieldPropEditor: public TPropertyEditor
{
public:
__fastcall aSetFieldPropEditor(void) : Dsgnintf::TPropertyEditor() {};



Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Jul 20, 2004 6:57 pm    Post subject: Re: deriving from TPropertyEditor Reply with quote




"ScOe" <cbinders (AT) hotmail (DOT) com> wrote


Quote:
I have problem writing my property editor derived class.
I get error that compiler could not find a match for
'TPropertyEditor::TPropertyEditor ()'

Which version of BCB are you actually using? TPropertyEditor's constructor
signature changes from one version to another. If you want to have a single
source file be compatible with multiple versions, then you have to use
precompiler conditionals to adjust your declarations according to the
version being used. I use the following code in my own property editors:

--- IDECompilerVariables.h ---

#ifndef IDECompilerVariablesH
#define IDECompilerVariablesH

#ifndef __BORLANDC__
#pragma message Unknown CBuilder version
#error Compiling for an unknown CBuilder version!
#endif // __BORLANDC__

// C++ Builder 3
#if ((__BORLANDC__ >= 0x530) && (__BORLANDC__ < 0x540))
#define CBUILDER3
#define VCL3ORABOVE

// C++ Builder 4
#elif ((__BORLANDC__ >= 0x540) && (__BORLANDC__ < 0x550))
#define CBUILDER4
#define VCL3ORABOVE
#define VCL4ORABOVE

// CBuilder 5
#elif ((__BORLANDC__ >= 0x550) && (__BORLANDC__ < 0x560))
#define CBUILDER5
#define VCL3ORABOVE
#define VCL4ORABOVE
#define VCL5ORABOVE

// CBuilder 6
#elif ((__BORLANDC__ >= 0x560) && (__BORLANDC__ < 0x570))
#define CBUILDER6
#define VCL3ORABOVE
#define VCL4ORABOVE
#define VCL5ORABOVE
#define VCL6ORABOVE

// unsupported version
#else
#pragma message CBuilder version: __BORLANDC__
#error Compiling for an unsupported CBuilder version!
#endif

#endif // IDECompilerVariablesH


--- IDEDesigners.h ---

#ifndef IDEDesignersH
#define IDEDesignersH

#include "IDECompilerVariables.h"

// different IDE versions use different class types for editors,
// so using macros so that the source code can be version-independant

#ifdef VCL6ORABOVE
#include #define FORM_DESIGNER_TYPE _di_IDesigner
#else
#include <DsgnIntf.hpp>
#ifdef VCL4ORABOVE
#define FORM_DESIGNER_TYPE _di_IFormDesigner
#else
#define FORM_DESIGNER_TYPE TFormDesigner*
#endif
#endif

#ifdef CBUILDER3
#define DECLARE_PROPERTY_EDITOR_CONSTRUCTOR(name) __fastcall
name(void)
#define DEFINE_PROPERTY_EDITOR_CONSTRUCTOR(name) __fastcall
name::name(void) : TPropertyEditor()
#else
#define DECLARE_PROPERTY_EDITOR_CONSTRUCTOR(name) __fastcall
name(const FORM_DESIGNER_TYPE ADesigner, int APropCount)
#define DEFINE_PROPERTY_EDITOR_CONSTRUCTOR(name) __fastcall
name::name(const FORM_DESIGNER_TYPE ADesigner, int APropCount) :
TPropertyEditor(ADesigner, APropCount)
#endif

#endif // IDEDesignersH


--- TMyPropertyEditor.h ---

#ifndef TMyPropertyEditorH
#define TMyPropertyEditorH

#include "IDEDesigners.h"

class TMyPropertyEditor : public TPropertyEditor
{
//...
public:
DECLARE_PROPERTY_EDITOR_CONSTRUCTOR(TMyPropertyEditor);
//...
};

#endif // TMyPropertyEditorH


--- TMyPropertyEditor.cpp ---

#include "TMyPropertyEditor.h"

DEFINE_PROPERTY_EDITOR_CONSTRUCTOR(TMyPropertyEditor),
OtherInitializersHere(...)
{
// initialization code here...
}


Gambit



Back to top
ScOe
Guest





PostPosted: Tue Jul 20, 2004 9:31 pm    Post subject: Re: deriving from TPropertyEditor Reply with quote


"Remy Lebeau (TeamB)" <gambit47.no.spam (AT) no (DOT) spam.yahoo.com> wrote

Quote:

"ScOe" <cbinders (AT) hotmail (DOT) com> wrote in message
news:40fd063e (AT) newsgroups (DOT) borland.com...

Which version of BCB are you actually using? TPropertyEditor's
constructor
signature changes from one version to another. If you want to have a
single


BCB5 .. thanx for code



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.