 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Daryl Guest
|
Posted: Tue Jun 14, 2005 1:53 am Post subject: Help needed with property editor - I think??? |
|
|
Hi
I have been trying to convert a Delphi component(s) to Builder 6 and I am a
terriable time. I have to admit I started doing this to get some knowledge
about components/packages, I would like to walk away but I can't - know the
feeling...
I have tried to install the components which have a Property Editor
(TStringProperty) into one package (Design and Runtime) and also split Run
time and Design Time packages.
Using (Design and Runtime) - I get it to compile and install in QReport
pallet - all OK. But, when I add the component to a QReport I get 18 Linker
Error Unresolved external __fastcall Designsditors::
TPropertyEditor::AllEqual() ' referenced... It looks like most of the
linker errors are for many of the methods that I did not choose/need to
use - Can anyone give me a reason why???
Using separate Run time and Design Time packages - I get it to compile and
install, except that when I check to see if components are actually visible
using 'Install Components' menu item the package does not contain the
components. I guess that are not being registered - Why I don't know, can
any please tell me why this could be?
I will provide the code I have used for the Property Editor as it seems that
this is the problem.
| Quote: | header file
//-------------------------------------------------------------------------- |
-
#include <vcl.h>
#pragma hdrstop
#ifndef qrcb_desH
#define qrcb_desH
//--------------------------------------------------------------------------
-
#include <DesignIntf.hpp>
#include "VCLEditors.hpp"
#include "DesignEditors.hpp"
#include "RTLConsts.hpp"
#include <TypInfo.hpp>
//--------------------------------------------------------------------------
-
// Property Editor
//--------------------------------------------------------------------------
-
class PACKAGE TcFieldsEditor : public TStringProperty
{
typedef TStringProperty inherited;
public:
virtual TPropertyAttributes __fastcall GetAttributes(void);
virtual void __fastcall GetValues(Classes::TGetStrProc Proc);
protected:
#pragma option push -w-inl
inline __fastcall virtual TcFieldsEditor(
_di_IProperty AProperty,
int APropCount)
: TStringProperty(AProperty,
APropCount) {}
#pragma option pop
public:
#pragma option push -w-inl
inline __fastcall virtual ~TcFieldsEditor(void) { }
#pragma option pop
};
//--------------------------------------------------------------------------
-
#endif
| Quote: | cpp file
//-------------------------------------------------------------------------- |
-
#include <vcl.h>
#pragma hdrstop
#include "qrcb_run.h"
#include "qrcb_des.h"
//--------------------------------------------------------------------------
-
#pragma package(smart_init)
#pragma resource "qrcb_res.res"
//--------------------------------------------------------------------------
-
// Property Editor
//--------------------------------------------------------------------------
-
TPropertyAttributes __fastcall TcFieldsEditor::GetAttributes(void)
{
return TPropertyAttributes() << paAutoUpdate << paRevertable
<< paValueList << paSortList;
}
//--------------------------------------------------------------------------
-
void __fastcall TcFieldsEditor::GetValues(Classes::TGetStrProc Proc)
{
TQRDBCheckBox *cb;
//Provide list of ftBoolean fields to Object Inspector...
cb = dynamic_cast
try {
if (cb->DataSet != NULL) {
//List every field in the selected DataSet
for (int i=0; i < cb->DataSet->FieldCount; ++i) {
if (cb->DataSet->Fields->Fields[i]->DataType == ftBoolean)
Proc(cb->DataSet->Fields->Fields[i]->FieldName);
}
}
}
catch(...) {
DatabaseError("DatabaseNameMissing");
}
}
//--------------------------------------------------------------------------
-
// Register Components and property Editor
//--------------------------------------------------------------------------
-
TPropInfo* PropInfo = ::GetPropInfo
(__typeinfo(TQRDBCheckBox), "DataField" );
namespace Qcomponents
{
void __fastcall PACKAGE Register() {
RegisterPropertyEditor(*PropInfo->PropType,
__classid(TQRDBCheckBox),
"DataField", __classid(TcFieldsEditor));
TComponentClass classes[2] = {__classid(TQRCheckBox),
__classid(TQRDBCheckBox)};
RegisterComponents("QReport", classes, 1);
}
}
//--------------------------------------------------------------------------
-
|
|
| Back to top |
|
 |
Ralph Kazemier Guest
|
Posted: Tue Jun 14, 2005 3:34 am Post subject: Re: Help needed with property editor - I think??? |
|
|
"Daryl" <developeracc (AT) hotmail (DOT) com> wrote
| Quote: | Using (Design and Runtime) - I get it to compile and install in QReport
pallet - all OK. But, when I add the component to a QReport I get 18
Linker
Error Unresolved external __fastcall Designsditors::
TPropertyEditor::AllEqual() ' referenced... It looks like most of the
linker errors are for many of the methods that I did not choose/need to
use - Can anyone give me a reason why???
|
Like you already noticed, you do need to seperate the designtime code from
the runtime code.
| Quote: | Using separate Run time and Design Time packages - I get it to compile and
install, except that when I check to see if components are actually
visible
using 'Install Components' menu item the package does not contain the
components. I guess that are not being registered - Why I don't know, can
any please tell me why this could be?
|
Please check to see whether the unit where the Register() method resides, is
called 'Qcomponents.cpp';
| Quote: | namespace Qcomponents
{
void __fastcall PACKAGE Register() {
snip |
The namespace name must be all lower case, except for the first letter, and
have the same name as the unit. Perhaps you renamed the unit while
seperating design and runtime code?
Ralph
|
|
| Back to top |
|
 |
Daryl Guest
|
Posted: Tue Jun 14, 2005 8:22 am Post subject: Re: Help needed with property editor - I think??? |
|
|
Ralph
You hit in one, I am glad I posted the problem and you answered. I was
not aware that the namespace must have the same name as the unit.
I changed it and everything appears to be OK - on the surface anyway.
Thank-you very much
daryl
| Quote: |
Please check to see whether the unit where the Register() method resides, is
called 'Qcomponents.cpp';
namespace Qcomponents
{
void __fastcall PACKAGE Register() {
snip
The namespace name must be all lower case, except for the first letter, and
have the same name as the unit. Perhaps you renamed the unit while
seperating design and runtime code?
Ralph
|
|
|
| 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
|
|