祝愿大家身体健康!

 站点注册  找回密码
 站点注册

QQ登录

只需一步,快速开始

查看: 4247|回复: 2

[转帖] 如何获得单击 Crosstab DataWindow 某域的值

[复制链接]

[转帖] 如何获得单击 Crosstab DataWindow 某域的值

[复制链接]
ehxz

主题

0

回帖

58万

积分

管理员

积分
588671
贡献
在线时间
小时
2007-6-26 12:11:44 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?站点注册

×
 

如何获得单击 Crosstab DataWindow 某域的值

 
  
 

  A crosstab DataWindow is a unique type of DataWindow. When it is built in the DataWindow painter, it is comprised of one row and one column. The remaining columns are dynamically created at runtime. This prevents the use of many of the functions normally used to obtain the value of a clicked item.

  At runtime, all columns have the same name as the column that was created in the DataWindow painter. The distinguishing difference in the column name is the suffix assigned to the column name. The column names take the form of:

  columnname_columnnumber~trownumber (row and column numbers are separated by a tab character and the column number is separated from the column name by an underscore character " _ ")

  The column number is relative to original column that was built with the DataWindow. The original column does not have a column number using the above notation. As an example a column number of two (2) would indicate that the column is the second column to the right of the original column.

  If you need the value of any of the detail columns they can not be obtained since the column name is the same and the column number must be parsed from a string. The only argument that can be used is the row argument of the clicked event. This will correctly return the row of the detail item clicked.

  Obtaining the correct column requires the use of the GetObjectAtPointer() function. This will return the column information in the form of:

  columnname_columnnumber~trownumber

  The column number has to be parsed from this value and used with the row number to obtain the data for the clicked item. With the row/column combination, we can use a GetItemNumber (or whatever GetItem is needed) in the form of:

  GetItemNumber( row, column )

  The column number MUST be used since all the columns have the same name.

  Below is the example code used to obtain the value of a clicked item in a crosstab DataWindow. Each line of code has a number and will be explained using these numbers as reference

1    string ls_detail, ls_name, ls_col
2    int li_pos, li_len, li_row, li_col
3    if left(getbandatpointer(),6) <> "detail" then return
4    ls_detail = getobjectatpointer()
5    ls_name = Object.#2.Name
6    if left(ls_detail,len(ls_name)) <> ls_name then return
7    li_row = row
8    li_len = len(ls_detail)
9    ls_col = right(ls_detail, li_len - len(ls_name))
10   if left(ls_col,1) <> "_" then)
11      li_col = 2
12   else
13      li_pos = pos(ls_col,"~t")
14      li_col = integer(mid(ls_col,2,li_pos - 1) ) + 2
15   end if
16   parent.title = string(getitemnumber(li_row,li_col))

  Line 1 and 2 are variables used for the process

  Line 3 - Get the band the user clicked in. if it is outside the detail area then return

  Line 4 - Get the column information for the clicked item

  Line 5 - Get the name of the column from the column number. We have to use column #2 in a crosstab since column number 1 is not in the detail area we need

  Line 6 - compare the column name from the column information from line 4 with the column name of the columns in the detail area we need. If they do not match, that means the user clicked in column 1, which is outside the detail area we need. This is needed since the GetBandAtPointer() will still return "detail" for any clicks in column one.

  Line 7 - Get the row of the clicked item

  Line 8 - Get the length of the column detail information obtained in line 4. This will be needed for parsing the column number from the detail information.

  Line 9 - get everything to the right of the column name.

  Line 10 and 11 - check for an "_" underscore. If there is not one, then we are in the first column of the detail area, which is really column 2.

  Line 13 - look for the tab character ( ~t ). The column number is between the underscore and the tab character.

  Line 14 - get the column number

  Line 16 - this is to display the value of the clicked item in the title bar of the window. (for demo purposes only). You will use the return from the GetItem for your value.
¡¡

  The above code can be copied into the clicked/doubleclicked event of a DataWindow control.

 

 

   
共享共进共赢Sharing And Win-win Results
SYBASEBBS - 免责申明1、欢迎访问“SYBASEBBS.COM”,本文内容及相关资源来源于网络,版权归版权方所有!本站原创内容版权归本站所有,请勿转载!
2、本文内容仅代表作者观点,不代表本站立场,作者自负,本站资源仅供学习研究,请勿非法使用,否则后果自负!请下载后24小时内删除!
3、本文内容,包括但不限于源码、文字、图片等,仅供参考。本站不对其安全性,正确性等作出保证。但本站会尽量审核会员发表的内容。
4、如本帖侵犯到任何版权问题,请立即告知本站 ,本站将及时删除并致以最深的歉意!客服邮箱:admin@sybasebbs.com
lovelyni

主题

0

回帖

76

积分

注册会员

积分
76
贡献
在线时间
小时
2007-12-19 22:10:20 | 显示全部楼层
看看就觉得好难啊,
共享共进共赢Sharing And Win-win Results
lovelyni

主题

0

回帖

76

积分

注册会员

积分
76
贡献
在线时间
小时
2007-12-19 22:10:47 | 显示全部楼层
[em01]哎~~~~~自己能力有限啊
共享共进共赢Sharing And Win-win Results
您需要登录后才可以回帖 登录 | 站点注册

本版积分规则

免责声明:
本站所发布的一切破解补丁、注册机和注册信息及软件的解密分析文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:Admin@SybaseBbs.com

QQ|Archiver|PowerBuilder(PB)BBS社区 ( 鲁ICP备2021027222号-1 )

GMT+8, 2024-11-24 12:46 , Processed in 0.029989 second(s), 9 queries , MemCached On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表