PB-BUG:解决调用setdetailheight在最后一行不能成功问题
调用setdetailheight函数可以改变某些行的高度,该函数常用于隐藏或显示某些符合条件的行,但是在调用时如果开始行号等于结束行号并且结束行号为最后一行时功能失效。
要解决该问题,可以先对函数参数进行判断,不同的参数进行不同的处理。对于开始行不等于结束行或结束行不是最后一行时调用系统的setdetailheight函数,否则先保存前一行行高再设置最后二行行号,设置后恢复倒数第二行行高。
以下是笔者自定义的of_setdeailheight函数,建立在数据窗口祖先中,你可以使用of_setdeailheight代替PB自带的setdeailheight函数,你也可以以类似的代码重载setdeailheight函数。
/*******************************************************************
函数名称:of_setdetailheight()
参数: al_beginrow long 开始行号
al_endrow long 结束行号
al_height long 新行高
返回值: long 是否成功(1表示成功,-1表示失败)
功能描述:设置指定范围内每行高度
创建人: 康剑民
创建日期:2005-04-18
版本号: V1.0
*******************************************************************/
long ll_return
long ll_detailheight_priorrow,ll_rowcount
string ls_detailheight_priorrow
ll_rowcount = this.rowcount()
if al_beginrow <> al_endrow or al_endrow <> ll_rowcount then
ll_return = this.setdetailheight(al_beginrow,al_endrow,al_height)
else
//由于PB在处理setdetailheight时前两个参数相等且为最后一行不能成功的BUG,
//解决的办法:先保存前一行行高再设置最后二行行号,设置后恢复倒数第二行行高
ls_detailheight_priorrow = this.describe("evaluate('rowheight()', " + string(ll_rowcount - 1) + ")")
if isnumber(ls_detailheight_priorrow) then
ll_detailheight_priorrow = long(ls_detailheight_priorrow)
else
ll_detailheight_priorrow = 0
end if
ll_return = this.setdetailheight(ll_rowcount - 1,ll_rowcount,al_height)
this.setdetailheight(ll_rowcount - 1,ll_rowcount - 1,ll_detailheight_priorrow)
end if
return ll_return
写作日期:2007-01-31
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1499324
-

没有评论:
发表评论