关于CB5中的事件__published问题

vchoushen6 2006-12-20 07:21:02
有两个类的结构如下:
class T1 : public TPersistent
{
......
__published:
__property int x = { read=Fx, write=Fx};
__property TNotifyEvent OnChanged = { read=FOnChanged,write=FOnChanged }

};
class T2 : public TComponent
{
private:
T1 * t1;
__published:
//如何在这里不用R/W函数,直接发布T1类的事件
};
T2放在Form中后,可以看到T1发布的属性,但事件属性却不行,由于我在T2中嵌入了多个类,要是用R/W函数的话,很麻烦,如何能不用R/W函数来完成这个功能呢?




...全文
228 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
chenxidu 2007-04-11
  • 打赏
  • 举报
回复
hehe
CACACACACA 2006-12-23
  • 打赏
  • 举报
回复
说错了.是可以公布出来的.D7下是可以的. BCB下还没试.
vchoushen6 2006-12-23
  • 打赏
  • 举报
回复
在CB5里做Component真不如Delphi里好,早知这样,还不如一开始就在Delphi里做,反正CB里也是可以用的
vchoushen6 2006-12-23
  • 打赏
  • 举报
回复
T2中的T1的属性可以展开的,但若从TComponent派生的话,是不行的,只可以生成一个下拉列表,或自定义属性编辑器。
laowang2 2006-12-23
  • 打赏
  • 举报
回复
up
CACACACACA 2006-12-22
  • 打赏
  • 举报
回复
published不出来的.

另外, 真的能看到 T1的 __property int x = { read=Fx, write=Fx}; 这个属性吗?
我这看不到啊. 是不是单独写了属性编辑器?
柯本 2006-12-20
  • 打赏
  • 举报
回复
好像没其它方法,见BCB的HELP:
Category

C++Builder keyword extensions

Syntax

<property declaration> ::=

__property <type> <id> [ <prop dim list> ] = "{" <prop attrib list> "}"

<prop dim list> ::= "[" <type> [ <id> ] "]" [ <prop dim list> ]

<prop attrib list> ::= <prop attrib> [ , <prop attrib list> ]

<prop attrib> ::= read = <data/function id>
<prop attrib> ::= write = <data/function id>
<prop attrib> ::= stored = <data/function id>
<prop attrib> ::= stored = <boolean constant>
<prop attrib> ::= default = <constant>

<prop attrib> ::= nodefault

<prop attrib> ::= index = <const int expression>
JugglingDB 是一个跨数据库的 ORM 框架,提供了访问大多数数据库的通用接口,支持包括:mysql, mongodb, redis, neo4j and js-memory-storage. 你可扩展其他数据库的适配器,支持回调和钩子。 示例代码: var Schema = require('./jugglingdb').Schema; var schema = new Schema('redis', {port: 6379}); //port number depends on your configuration // define models var Post = schema.define('Post', { title: { type: String, length: 255 }, content: { type: Schema.Text }, date: { type: Date, default: Date.now }, published: { type: Boolean, default: false } }); // simplier way to describe model var User = schema.define('User', { name: String, bio: Schema.Text, approved: Boolean, joinedAt: Date, age: Number }); // setup relationships User.hasMany(Post, {as: 'posts', foreignKey: 'userId'}); // creates instance methods: // user.posts(conds) // user.posts.build(data) // like new Post({userId: user.id}); // user.posts.create(data) // build and save Post.belongsTo(User, {as: 'author', foreignKey: 'userId'}); // creates instance methods: // post.author(callback) -- getter when called with function // post.author() -- sync getter when called without params // post.author(user) -- setter when called with object schema.automigrate(); // required only for mysql NOTE: it will drop User and Post tables // work with models: var user = new User; user.save(function (err) { var post = user.posts.build({title: 'Hello world'}); post.save(console.log); }); // or just call it as function (with the same result): var user = User(); user.save(...); // Common API methods // just instantiate model new Post // save model (of course async) Post.create(cb); // all posts Post.all(cb) // all posts by user Post.all({where: {userId: user.id}, order: 'id', limit: 10, skip: 20}); // the same as prev user.posts(cb) // same as new Post({userId: user.id}); user.posts.build // save as Post.create({userId: user.id}, cb); user.posts.create(cb) // find instance by id User.find(1, cb) // count instances User.count([conditions, ]cb) // destroy instance user.destroy(cb); // destroy all instances User.destroyAll(cb); // Setup validations User.validatesPresenceOf('name', 'email') User.validatesLengthOf('password', {min: 5, message: {min: 'Password is too short'}}); User.validatesInclusionOf('gender', {in: ['male', 'female']}); User.validatesExclusionOf('domain', {in: ['www', 'billing', 'admin']}); User.validatesNumericalityOf('age', {int: true}); User.validatesUniquenessOf('email', {message: 'email is not unique'}); user.isValid(function (valid) { if (!valid) { user.errors // hash of errors {attr: [errmessage, errmessage, ...], attr: ...} } }) 标签:JugglingDB

604

社区成员

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

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