如何只在数据窗口的第一页显示标题?

小小的一株含羞草 2003-10-08 10:21:35
我在datawindow的scrollverical事件中加入如下语句,可是它每次总是又跳回到第一页,不知这是怎么回事?哪位知道?谢谢

page_0是一个隐藏的字段列,用来存放当前页码
lds_report_define中存放的是当前报表所有字段的名称、宽度等属性定义

ll_temp = Long( This.Object.DataWindow.FirstRowOnPage )
ll_pagecount = This.GetItemNumber( ll_temp, "page_0" )

CHOOSE CASE ll_pagecount
CASE 1
//title可见时
This.SetRedraw( FALSE )
This.Modify("DataWindow.header.Height='" + String( ll_header_height + ll_title_height ) + "'")
ll_rowcount = lds_report_define.RowCount( )
FOR ll_temp = 1 TO ll_rowcount
ls_chinesename = lds_report_define.GetItemString( ll_temp, "col_chinese_name" )
ls_fieldtextname = ls_chinesename + "_t"
This.Modify( ls_fieldtextname + ".y='" + String( ll_title_height + 6 ) + "'" )
NEXT
This.SetRedraw( TRUE )
CASE ELSE
//title不可见时
This.SetRedraw( FALSE )
This.Modify("DataWindow.header.Height='" + String( ll_header_height ) + "'")
ll_rowcount = lds_report_define.RowCount( )
FOR ll_temp = 1 TO ll_rowcount
ls_chinesename = lds_report_define.GetItemString( ll_temp, "col_chinese_name" )
ls_fieldtextname = ls_chinesename + "_t"
This.Modify( ls_fieldtextname + ".y='6'" )
NEXT
This.SetRedraw( TRUE )
END CHOOSE
Return 0
...全文
48 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
那加在什么事件中呢?
鸡翅多 2003-10-08
  • 打赏
  • 举报
回复
为什么要加在scrollverical事件中???
  • 打赏
  • 举报
回复
自己解决了,呵呵
scrollvertical事件中写入如下语句:
Long ll_nowrow

ll_nowrow = Long( This.Object.DataWindow.FirstRowOnPage )
This.SetRow( ll_nowrow )

Return 0

在rowfocuschanged事件中写入语句:
DataStore lds_report_define
Long ll_title_height, ll_header_height
Long ll_rowcount, ll_temp, ll_pagecount
String ls_chinesename, ls_fieldtextname

This.SetRedraw( FALSE )

//得到header和title区域的高度
ll_header_height = il_height_header
ll_title_height = il_height_title

//创建、初始化存放字段信息的datastore
lds_report_define = CREATE DataStore
lds_report_define.dataObject = "d_report_define"
lds_report_define.SetTransObject( SQLCA_LocalConfigDB)
lds_report_define.Reset( )
ids_report_define.RowsCopy( 1, ids_report_define.RowCount( ), Primary!, &
lds_report_define, 1, Primary! )

ll_pagecount = This.GetItemNumber( currentrow, "page_0" )

CHOOSE CASE ll_pagecount
CASE 1
//title可见时
This.Modify("DataWindow.header.Height='" + String( ll_header_height + ll_title_height ) + "'")
ll_rowcount = lds_report_define.RowCount( )
FOR ll_temp = 1 TO ll_rowcount
Yield( )
ls_chinesename = lds_report_define.GetItemString( ll_temp, "col_chinese_name" )
ls_fieldtextname = ls_chinesename + "_t"
This.Modify( ls_fieldtextname + ".y='" + String( ll_title_height + 6 ) + "'" )
NEXT
ib_isfirstchangeheader = TRUE
CASE ELSE
//title不可见时
IF ib_isfirstchangeheader THEN
This.Modify("DataWindow.header.Height='" + String( ll_header_height ) + "'")
ll_rowcount = lds_report_define.RowCount( )
FOR ll_temp = 1 TO ll_rowcount
Yield( )
ls_chinesename = lds_report_define.GetItemString( ll_temp, "col_chinese_name" )
ls_fieldtextname = ls_chinesename + "_t"
This.Modify( ls_fieldtextname + ".y='6'" )
NEXT
ib_isfirstchangeheader = FALSE
END IF
END CHOOSE

Destroy lds_report_define

This.ScrolltoRow( currentrow )

This.SetRedraw( TRUE )

Return 0
  • 打赏
  • 举报
回复
标题的visible属性我已经设置成了只在第一页显示了
我现在主要的问题是,我的报表是grid型的,在第一页显示时我将报表标题设置成foreground,并且在下面生成了一个白板,以挡住格线,同时所有header区域的显示字段名的文本控件的y值是加了一个标题区域的高度的;在第二页显示时需要将header区域的显示字段名的控件的y值改为不加标题区域高度。

不知我描述清楚了没有?谢谢:)
klbt 2003-10-08
  • 打赏
  • 举报
回复
前些天讨论过,在数据窗口标题的visible属性上编码实现。
可以搜索一下。

609

社区成员

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

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