如何动态修改数据窗口里的对象的所在带区?

lian_yi 2017-07-14 01:54:10
比如一个数据窗口里有个文本,t1设计时是band,如果在运行时把它改成foreground
...全文
389 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
lian_yi 2017-07-25
  • 打赏
  • 举报
回复
引用 8 楼 eclat2299 的回复:
我做了測試 只有這一行會報錯 dw_1.Object.code_key_t.Band PB的說明中有這一行: Describe and Modify argument: 使用Modify不會報錯, 但band並沒有任何改變 //---- 下列為測試的程式碼 ----- string ls_band_value //取值 describe ls_band_value=dw_1.Describe('code_key_t.Band') MessageBox('Describe',ls_band_value) ls_band_value='' //取值 object ls_band_value=dw_1.Object.code_key_t.Band MessageBox('Object',ls_band_value) ls_band_value='' //設置 modify dw_1.Modify("code_key_t.Band='foreground'") //<--- 可順利運行, 但沒有效果, 內容值沒有改變 ls_band_value=dw_1.Describe('code_key_t.Band') MessageBox('Modify',ls_band_value) ls_band_value='' //設置 object dw_1.Object.code_key_t.Band='foreground' //<----- 只有這一行會報錯 ls_band_value=dw_1.Object.code_key_t.Band MessageBox('Object',ls_band_value) ls_band_value=''
看来也就是这个样子了,感谢大家!!
lian_yi 2017-07-21
  • 打赏
  • 举报
回复
引用 6 楼 eclat2299 的回复:
依PB說明, 這個property好像只能用SetPosition變更 Description The band or layer in the DataWindow object that contains the control. The returned text is one of the following, where # is the level number of a group: detail, footer, header, header.#, summary, trailer.#, tree.level.#, foreground, background. Changing a control's band Use the SetPosition method to change a control's band at runtime. Controls Button, Column, Computed Field, Graph, GroupBox, Line, OLE, Oval, Picture, Rectangle, Report, RoundRectangle, TableBlob, and Text controls Syntax PowerBuilder dot notation: dw_control.Object.controlname.Band Describe and Modify argument: "controlname.Band" Parameter Description controlname The name of the control within the DataWindow for which you want the band it occupies Usage In the painter Select the control and set the value in the Properties view, Position tab, Layer option. When the control's layer is Band, you can drag the control into another band.
但是你看这帮助里也有那上面报错的两种方法,如果这两种方法不能用,为什么还要写在帮助里呢?还是我没有看懂这帮助的意思?是说这两种不能用?
eclat2299 2017-07-21
  • 打赏
  • 举报
回复
依PB說明, 這個property好像只能用SetPosition變更 Description The band or layer in the DataWindow object that contains the control. The returned text is one of the following, where # is the level number of a group: detail, footer, header, header.#, summary, trailer.#, tree.level.#, foreground, background. Changing a control's band Use the SetPosition method to change a control's band at runtime. Controls Button, Column, Computed Field, Graph, GroupBox, Line, OLE, Oval, Picture, Rectangle, Report, RoundRectangle, TableBlob, and Text controls Syntax PowerBuilder dot notation: dw_control.Object.controlname.Band Describe and Modify argument: "controlname.Band" Parameter Description controlname The name of the control within the DataWindow for which you want the band it occupies Usage In the painter Select the control and set the value in the Properties view, Position tab, Layer option. When the control's layer is Band, you can drag the control into another band.
lian_yi 2017-07-21
  • 打赏
  • 举报
回复
引用 4 楼 a78782295 的回复:
dw_1.SetPosition("t_1", "foreground", true)
你说得对,是这个!但还有其他的方法吗?为什么上面两个方法就报错呢?!
eclat2299 2017-07-21
  • 打赏
  • 举报
回复
我做了測試 只有這一行會報錯 dw_1.Object.code_key_t.Band PB的說明中有這一行: Describe and Modify argument: 使用Modify不會報錯, 但band並沒有任何改變 //---- 下列為測試的程式碼 ----- string ls_band_value //取值 describe ls_band_value=dw_1.Describe('code_key_t.Band') MessageBox('Describe',ls_band_value) ls_band_value='' //取值 object ls_band_value=dw_1.Object.code_key_t.Band MessageBox('Object',ls_band_value) ls_band_value='' //設置 modify dw_1.Modify("code_key_t.Band='foreground'") //<--- 可順利運行, 但沒有效果, 內容值沒有改變 ls_band_value=dw_1.Describe('code_key_t.Band') MessageBox('Modify',ls_band_value) ls_band_value='' //設置 object dw_1.Object.code_key_t.Band='foreground' //<----- 只有這一行會報錯 ls_band_value=dw_1.Object.code_key_t.Band MessageBox('Object',ls_band_value) ls_band_value=''
a78782295 2017-07-20
  • 打赏
  • 举报
回复
dw_1.SetPosition("t_1", "foreground", true)
WorldMobile 2017-07-17
  • 打赏
  • 举报
回复
dw.object.t1.band="Foreground"
lian_yi 2017-07-17
  • 打赏
  • 举报
回复
引用 1 楼 r00_a2lBUR 的回复:
dw.modify('t1.band="foreground"')
引用 2 楼 lzp_lrp 的回复:
dw.object.t1.band="Foreground"
这两个都会报错的
r00_a2lBUR 2017-07-14
  • 打赏
  • 举报
回复
dw.modify('t1.band="foreground"')

609

社区成员

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

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