谁写过属性编辑器,我写的时候总说RegisterPorpertyEditor函数未定义,请帮忙!

bigfrogliuguang 2003-08-22 07:13:00
我写的时候总说RegisterPorpertyEditor函数未定义
我是看一本书上写的
那位给出详细的步骤,一定给分!
...全文
50 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
bigfrogliuguang 2003-08-25
  • 打赏
  • 举报
回复
这次我知道错误的地方在于头文件不对,头文件应该是DesignEditors.hpp
真是感谢热心的Aweay,希望以后还能得到你的帮助!
Siney 2003-08-24
  • 打赏
  • 举报
回复
加入DesignIDE.bpi 到工程,下面是我写的About属性编辑器的注册代码:

PPropInfo pPropInfo = ::GetPropInfo(__typeinfo(TVecCanvas), "About");
RegisterPropertyEditor(*(pPropInfo->PropType), __classid(TVecCanvas),
"About", __classid(TMyAboutProperty));

最后你需要把-LUDesignIde 加入工程的PFlag的选项里,不过一般不用这步,你可以先试一试上面的代码。
bigfrogliuguang 2003-08-24
  • 打赏
  • 举报
回复
嗯 注册编辑器的代码是这样的:
namespace Mycompont
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[1] = {__classid(TMyCompont)};
RegisterComponents("Samples", classes, 0);
RegisterPropertyEditor(__typeinfo(TMyGraphic),__classid(TMyCompont),"Graphics",__classid(TMyPropertyEditor));

}
}
DesignIntf.hpp也被包含在里边 就是说RegisterPropertyEditor不可识别的函数 呵呵
真是奇怪死了 谢谢Aweay拉
Siney 2003-08-23
  • 打赏
  • 举报
回复
把你的代码贴出来
bigfrogliuguang 2003-08-23
  • 打赏
  • 举报
回复
我按照c++Builder高级应用开发指南里来做,先写了一个组件,写属性编辑器
包含了上述文件还是有错,说什么Type name expected
本人是新手 往指教!
bigfrogliuguang 2003-08-23
  • 打赏
  • 举报
回复
直接自己写一个类继承PropertyEditor就可以做一个属性编辑器了么,能不能给出详细一点的步骤阿
Siney 2003-08-23
  • 打赏
  • 举报
回复
在那里出错了,说的明白些啊,没有看见你的注册编辑器的代码啊
cupidvenus 2003-08-23
  • 打赏
  • 举报
回复
同意
bigfrogliuguang 2003-08-23
  • 打赏
  • 举报
回复
这里是.h文件
#ifndef EditH
#define EditH
#include "MyCompont.h"
#include "Unit1.h"
#include <DesignIntf.hpp>
//---------------------------------------------------------------------------
#endif
class PACKAGE TMyPropertyEditorm// : public TPropertyEditor
{
public:
__fastcall TMyPropertyEditor(const _di_IFormDesigner ADesigner,int
APropCount);
__fastcall ~TMyProPertyEditor();
};
//----------------------------------------------------------------------------
这里是.cpp文件
#pragma hdrstop

#include "Edit.h"


//---------------------------------------------------------------------------

#pragma package(smart_init)

__fastcall TMyPropertyEditor::TMyPropertyEditor(const _di_IFormDesigner ADesigner,int
APropCount) :TPropertyEditor(const_di_IDesigner ADesigner, int APropCount)
{

}

void __fastcall TMyPropertyEditor::SetValue(const AnsiString Value)
{
((TMyCompont *)GetCompont(0))->Graphics->Test=StrToInt(Value);

}
String __fastcall TMyPropertyEditor::GetValue()
{
String tmps=IntToStr(((TMyCompont*)GetCompont(0))->Test);
return tmps;

}
TPropertyAttributes __fastcall TMyPropertyEditor::GetAttributes()
{
return TPropertyAttributes()<<paDialog;
}
void __fastcall TMyPropertyEditor::Edit()
{
frmEditGraphic=new TfrmEditGraphic(NULL);
frmEditGraphic(0)->edTest->Text=IntToStr(((TMyCompont *)GetCompont(0))->
Graphics->Test);
if(frmEditGraphic->ShowModal()==mrOk)
{
((TMyCompont *)GetComponent(0))->Test=StrToInt(frmEditGraphic->
edTest->Text);
delete frmEditGraphic;

}


}
Siney 2003-08-22
  • 打赏
  • 举报
回复
是RegisterPropertyEditor

要加入DesignIntf头文件(BCB6)
如果是BCB5则是(Degnintf)

604

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder VCL组件使用和开发
社区管理员
  • VCL组件使用和开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧