在BCB6中是否无法用与BCB5一样的方法注册属性编辑器了?

时间:2022-02-21 21:01:52
编译时显示如下错误:
Build
  [Linker Error] Unresolved external '__tpdsc__ Designeditors::TStringProperty' referenced from H:\BHDRAWFORM.OBJ
  [Linker Error] Unresolved external 'Designeditors::TStringProperty::' referenced from H:\BHDRAWFORM.OBJ
  [Linker Error] Unresolved external '__fastcall Designeditors::TPropertyEditor::~TPropertyEditor()' referenced from H:\BHDRAWFORM.OBJ
  [Linker Error] Unresolved external '__fastcall Designeditors::TPropertyEditor::Initialize()' referenced from H:\BHDRAWFORM.OBJ
  [Linker Error] Unresolved external '__fastcall Designeditors::TPropertyEditor::SetPropEntry(int, Classes::TPersistent *, Typinfo::TPropInfo *)' referenced from H:\BHDRAWFORM.OBJ
  [Linker Error] Unresolved external '__fastcall Designeditors::TPropertyEditor::TPropertyEditor(const System::DelphiInterface<Designintf::IDesigner>, int)' referenced from H:\BHDRAWFORM.OBJ
  [Linker Error] Unresolved external '__fastcall Designeditors::TPropertyEditor::Activate()' referenced from H:\BHDRAWFORM.OBJ
  [Linker Error] Unresolved external '__fastcall Designeditors::TStringProperty::AllEqual()' referenced from H:\BHDRAWFORM.OBJ
  [Linker Error] Unresolved external '__fastcall Designeditors::TPropertyEditor::AutoFill()' referenced from H:\BHDRAWFORM.OBJ
  [Linker Error] Unresolved external '__fastcall Designeditors::TStringProperty::GetEditLimit()' referenced from H:\BHDRAWFORM.OBJ
  [Linker Error] Unresolved external '__fastcall Designeditors::TPropertyEditor::GetName()' referenced from H:\BHDRAWFORM.OBJ
  [Linker Error] Unresolved external '__fastcall Designeditors::TPropertyEditor::GetProperties(void __fastcall __closure(*)(const System::DelphiInterface<Designintf::IProperty>))' referenced from H:\BHDRAWFORM.OBJ
  [Linker Error] Unresolved external '__fastcall Designeditors::TPropertyEditor::GetPropInfo()' referenced from H:\BHDRAWFORM.OBJ
  [Linker Error] Unresolved external '__fastcall Designeditors::TStringProperty::GetValue()' referenced from H:\BHDRAWFORM.OBJ
  [Linker Error] Unresolved external '__fastcall Designeditors::TPropertyEditor::GetValues(void __fastcall __closure(*)(const System::AnsiString))' referenced from H:\BHDRAWFORM.OBJ
  [Linker Error] Unresolved external '__fastcall Designeditors::TStringProperty::SetValue(const System::AnsiString)' referenced from H:\BHDRAWFORM.OBJ
  [Linker Error] Unresolved external '__fastcall Designintf::RegisterPropertyEditor(Typinfo::TTypeInfo *, System::TMetaClass *, const System::AnsiString, System::TMetaClass *)' referenced from H:\BHDRAWFORM.OBJ

下面是属性编辑器的代码:
class PACKAGE BHDrawFormPictureProperty : public TStringProperty
{
public:
  __fastcall TPropertyAttributes GetAttributes()
  {
    return TPropertyAttributes() << paDialog ;
  }
  void __fastcall Edit()
  {
    TOpenPictureDialog* dlg = new TOpenPictureDialog( 0 ) ;
    dlg->Filter = "*.bmp|*.bmp" ;
    if( dlg->Execute() ){
      Value = dlg->FileName ;
    }
    delete dlg ;
  }
};

通过下面的语句注册:
RegisterPropertyEditor( AnsiStringTypeInfo() , __classid( BHDrawForm ) , "Picture" , __classid( BHDrawFormPictureProperty ) ) ;
但就出现上述错误,注掉此语句后,一切正常,组件可以被注册使用。
AnsiStringTypeInfo如下定义:
TTypeInfo* AnsiStringTypeInfo()
{
  TTypeInfo* typeInfo = new TTypeInfo ;
  typeInfo->Name = "AnsiString" ;
  typeInfo->Kind = tkLString ;
  return typeInfo ;
}

到底是为什么不能注册呢?

7 个解决方案

#1


在Requires结点下加上designide.bpi后,编译通过了,但就是无效果,系统还是使用的默认的属性编辑器,而不是我注册的新的属性编辑器。
这是为什么呢?
各位大侠救命啊!

#2


没写过VCL控件,帮你up吧。

#3


我也up

#4


看一下帮助中 what's new in C++ Builder。这里介绍了5和6之间的不同之处,你的问题主要是几个单元的名称改变所引起的。

#5


同意楼上的意见。

我改造BCB5.0的控件(不是定义的属性编辑控件,而是业务控件)到BCB6.0环境时,修改了头文件中的INCLUDE部分。

BCB50的环境下
#include <DsgnIntf.hpp>

BCB60的环境下
#include <DesignIntf.hpp>
#include <DesignEditors.hpp>
#include <VCLEditors.hpp>

#6


关注

#1


在Requires结点下加上designide.bpi后,编译通过了,但就是无效果,系统还是使用的默认的属性编辑器,而不是我注册的新的属性编辑器。
这是为什么呢?
各位大侠救命啊!

#2


没写过VCL控件,帮你up吧。

#3


我也up

#4


看一下帮助中 what's new in C++ Builder。这里介绍了5和6之间的不同之处,你的问题主要是几个单元的名称改变所引起的。

#5


同意楼上的意见。

我改造BCB5.0的控件(不是定义的属性编辑控件,而是业务控件)到BCB6.0环境时,修改了头文件中的INCLUDE部分。

BCB50的环境下
#include <DsgnIntf.hpp>

BCB60的环境下
#include <DesignIntf.hpp>
#include <DesignEditors.hpp>
#include <VCLEditors.hpp>

#6


关注