老问题,dw字段的自动换行

sjlion 2009-07-14 05:04:10
PB9.0,grid风格数据窗口对象。

1) 在DataWindow Painter中打开此DataWindow对象。
2) 在需设定自动折行的列上双击鼠标, 弹开此列的属性窗口。
3) 选择Position标签, 选中Autosize Height 多选框。
4) 选择Edit标签, 不选中Auto Horz Scroll多选框。
5) 单击OK按钮, 保存所做的修改。
6) 点中Detail Band (即写有Detail的灰色长带), 单击鼠标右键, 选择 Properties... 菜单项。
7) 选中Autosize Height多选框。
8) 单击OK按钮, 保存所做的修改。
9) 保存此DataWindow。

上述方法不可行,哪位准备粘贴来当答案,先谢谢了。

以前用过freeform风格的,方法是
设了detail band的Autosize Height,去掉自动折行列的Autosize Height,选中折行列的auto vertscroll,去掉自动折行列的Auto Horz Scroll。

但用在grid是不行的。
...全文
224 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
talenter 2009-08-06
  • 打赏
  • 举报
回复
选择Position标签, 选中Autosize Height 多选框
点中Detail Band (即写有Detail的灰色长带), 单击鼠标右键, 选择 Properties... 菜单项

就这两个应该行了吧 不行话
再弄个Y2里的表达式 写成rowheight()+2
newease 2009-07-15
  • 打赏
  • 举报
回复
方法应该是可行的,不过对汉字的处理不是精确,对于连续的中文当一个单词处理,如果加空格就应该可以

下面是收藏的代码,可以试试能否实现自动换行且自动高度


字段如何自动换行的同时且自动高度?

答:将数据窗口中相应列的auto horz scroll 为不选中,选中autosize height
将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

sjlion 2009-07-15
  • 打赏
  • 举报
回复
加10分,再顶
sjlion 2009-07-14
  • 打赏
  • 举报
回复
咦,这10分没人赚吗?自己顶下

609

社区成员

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

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