如何将用户对象的值传递给窗口?

taitan 2002-11-05 05:17:22
我自己定义了一个用户对象(User Object)打算将对象中的一个字符变量传给调用他的窗口的一个文本框里,怎么传递?

请教各位。。。
...全文
81 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
pufan 2002-11-06
  • 打赏
  • 举报
回复
1.如窗口名已知
在uo_c_x的cb_1的clicked事件中写
w_windowname.sle_2.text="test"

2.如窗口名为未知,则在
cb_1的clicked事件中写
w_windowname w_1
w_1=parent.getparent()
w_1.sle_2.text="test"
taitan 2002-11-06
  • 打赏
  • 举报
回复
假设uo_c_x 为我的用户对象,上面有一个按钮cb_1和一个文本框sle_1 在执行了按钮单击操作后文本框里的值就变为了'test'

我要实现这样的要求:将uo_c_x放置到一个窗体上窗体上还有一个文本框sle_2, sle_2不在uo_c_x上,要求单击uo_c_x上的按钮sle_1和sle_2同时显示‘test’
即把sle_1的值传给sle_2,但要在单击上实现。
怎么实现?
DoIwant 2002-11-06
  • 打赏
  • 举报
回复
1、定义一个全局变量string is_test 和 window lw_window
单击事件:clicked
sle_1.text = 'test'
ls_test = 'test'
uf_trigger()
2、在对象中定义一个函数(user object function) uf_trigger
lw_window.triggerevent('ue_retrieve')
3、在调用窗口中定义一个用户事件ue_retrieve
sting ls_test
ls_test = is_test
4、在窗口的open事件中写脚本
lw_window = this
LynnWang 2002-11-06
  • 打赏
  • 举报
回复
在uo_c_x中new一个名为ue_test的event,在cb_1的clicked事件写道:
parent.event ue_test()
然后窗口中的uo_1(在窗口中添加的uo_c_x)的ue_test事件中写道:
sle_2.text = this.sle_1.text
即可!

balloonman2002 2002-11-05
  • 打赏
  • 举报
回复
1、假设UO为uo_c_x,其中字符串变量为:
string is_test
在uo_c_x的CONSTRUCTOR中:is_test="test"

2、在窗口中只要:
uo_c_x io_x
io_x=create uo_c_x
sle_1.text=io_x.is_test
destroy io_x
balloonman2002 2002-11-05
  • 打赏
  • 举报
回复
1、假设UO为uo_c_x,其中字符串变量为:
string is_test
在uo_c_x的CONSTRUCTOR中:is_test="test"

2、在窗口中只要:
uo_c_x io_x
io_x=create uo_c_x
sle_1.text=io_x.is_test
destroy io_x

740

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 脚本语言
社区管理员
  • 脚本语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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