当前位置:首页 > 技能相关 > PowerBuilder > 正文内容

PB DataWindw的字段自动换行的同时且自动高度的方法

admin1年前 (2023-12-30)PowerBuilder6430 修订时间:2023-12-30 12:48:44

将数据窗口中相应列的auto horz scroll 为不选中,将detail的autosize height选中。在数据窗口retrieve 后调用下面函数即可

uf_set_text(datawindow adw_content,string

as_columns,boolean,ab_ignoreblank)

/*************************************************************

describe: 在数据窗口adw_content中,在as_columns中包含的列中插入空格

args:

as_columns 要操作的多个列,列间用逗号隔开

*************************************************************/

if (not isvalid(adw_content)) or isnull(as_columns) or len(as_columns)<1 or isnull(ab_ignoreblank) then return -1
n_cst_string lnv_string
string ls_column[] , ls_width ,as_source,as_replaced ,ls_temp
int li_upperbound , li_width , li_column , li_fontWidth, li_counter
long ll_rowcount , ll_row , ll_totalstep
int li_yield
lnv_string.of_parsetoarray(as_columns,',',ls_column)
li_upperbound = upperbound(ls_column)
ll_rowcount = adw_content.rowcount()
if li_upperbound<1 or ll_rowcount<1 then return -1
openwithparm(w_waiting,this)
ib_cancel = false
iw_frame.enabled = false
ll_totalstep = ll_rowcount * li_upperbound
w_waiting.uf_register(ll_totalstep)
for li_column = 1 to li_upperbound
ls_width = adw_content.describe(ls_column[li_column]+".width")
li_width = integer(ls_width)
if ls_width='!' or ls_width='?' or li_width=0 then
continue
end if
//ls_temp = adw_content.describe(ls_column[li_column]+".Font.property { = 'width' }")
//messagebox(ls_column[li_column]+".Font.property { = 'width' }",ls_temp)
//return 1
li_fontwidth = 27
li_counter = li_width / li_fontWidth
for ll_row=1 to ll_rowcount
if ib_cancel then
iw_frame.enabled = true
return 0 //pressed cancel button
end if
as_source = adw_content.getitemstring(ll_row,ls_column[li_column])
as_replaced = uf_insertstring(as_source,li_counter,' ',false)
if as_replaced<>as_source then
adw_content.setitem(ll_row,ls_column[li_column],as_replaced)
end if
w_waiting.uf_stepit()
next
next
close(w_waiting)
iw_frame.enabled = true
return 1


 您阅读本篇文章共花了: 

免责声明
本站内容均为博客主本人日常使用记录的存档,如侵犯你的权益请联系:lifei@zaiheze.com 546262132@qq.com 沟通删除事宜。本站仅带访问端口形式使用,已杜绝搜索引擎爬取。

扫描二维码推送至手机访问。

版权声明:本文由LIFEI - blog发布,如需转载请注明出处。

本文链接:http://www.lifeiai.com/?id=358

分享给朋友:

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。