关于addobject方法程序

fangyi1120 2003-05-04 02:16:39
我在表单的load中添加一个container
this.addobject('container'+markstr,'container') //markstr为一字符型变量
namestr='container'+markstr
this.namestr.visible=.t.
本意是namestr作为container对象的name,但编译时namestr不能识别。
怎样解决?

...全文
173 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiolig 2003-05-07
  • 打赏
  • 举报
回复
LOCAL p
p = 'Command' + markstr
THIS.AddObject(p,'CommandButton')
THIS.&p..Visible = .T.
fangyi1120 2003-05-07
  • 打赏
  • 举报
回复
也不对呀!
xiolig 2003-05-06
  • 打赏
  • 举报
回复
使用宏替换时,宏替换后的第一个小数点被解释成宏替换结束符,因此:
应该将 this.&p.left=80 改写为 this.&p..left=80
fangyi1120 2003-05-06
  • 打赏
  • 举报
回复
楼上的,编译时kkk找不到,Why?
zhongyj 2003-05-05
  • 打赏
  • 举报
回复
obj=eval("this."+namestr)
obj.visible=.t.
fangyi1120 2003-05-05
  • 打赏
  • 举报
回复
在form 的init 中,
s='kkk'
thisform.addobject('command'+s,'command')
p='command'+s
this.&p.visible=.t.
this.&p.top=90
this.&p.height=90
this.&p.width=190
this.&p.left=80
错误是第二行无command类的定义。
commandkkk.visible属性找不到等
难道添加command,shape之类的控件还要自己定义???
marki 2003-05-05
  • 打赏
  • 举报
回复
在form 的init 中,
s='kkk'
p='command'+s
thisform.addobject(&s,'command')

this.&p.visible=.t.
this.&p.top=90
this.&p.height=90
this.&p.width=190
this.&p.left=80
marki 2003-05-04
  • 打赏
  • 举报
回复
試試this.&namestr.visible=.t.
fangyi1120 2003-05-04
  • 打赏
  • 举报
回复
Sorry,我打错了,本来是写在form 的init 中的。
我的想法是:可能namestr已经被当作字符变量,只是与一个对象同名,问题是如何区别两个。
如何引用对象。
newfang 2003-05-04
  • 打赏
  • 举报
回复
把代码贴到表单的init事件试试。

2,749

社区成员

发帖
与我相关
我的任务
社区描述
VFP,是Microsoft公司推出的数据库开发软件,用它来开发数据库,既简单又方便。
社区管理员
  • VFP社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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