-1

我有一个使用 select 获取记录的 DataWindow。

我想要做的是能够单击任何记录并打开一个新窗口/数据窗口以显示有关该选定/单击记录的更多信息。

我对 PB8 还很陌生,目前正在为此苦苦挣扎。

请您指导我正确的方向,将不胜感激。

干杯。

4

2 回答 2

1

听起来你对 PB 很陌生,所以我会给你一个非常简单的示例来帮助你入门。可能会按照 Terry 的建议考虑双击,但单击也可以。

假设:

  • 您的数据窗口控件名称是dw_customer_list
  • 您的列值(键)名为 customer_id 并且是数字
  • 您要打开的窗口名称名为w_customer_detail
  • 传递的值是一个数字,否则使用 StringParm 或 PowerObjectParm
  • 如果您使用 mdi "sheets",请考虑使用 opensheetwithparm 而不是 openwithparm

dw_customer_list的单击事件中,添加代码以获取要在打开的窗口上显示的任何内容的键值。如果您使用字符串,则使用 getitemstring 而不是 getitemnumber

double ld_custid

if IsNull(row) then return 0

if row > 0 and row <= RowCount() then
   ld_custid= this.GetItemNumber(row, 'customer_id')
   OpenWithParm(w_customer, ld_custid)
end if

在您想要显示客户的w_customer_detail中,在open 事件中放置类似的内容以获取传递的参数并对其进行处理。某天,当您对 postopen 事件以及使用它的好处感到无聊时。此外,如果您传递的是字符串而不是数字,则只需使用 Message.StringParm 而不是 DoubleParm。

double ld_custid

// grab the passed number parameter
if not IsNull(message.DoubleParm) then
   ld_custid= message.DoubleParm
   messagebox('Customer ID parameter:', string(ld_custid))
else
   // no parmameter!
   messagebox('Customer ID parameter:', 'was not passed to window')
end if
于 2013-09-20T04:09:40.767 回答
1

您想查看OpenWithParm()OpenSheetWithParm(),并从 DataWindow 控件(在窗口上)的 Clicked 事件(我推荐 DoubleClicked,但这是您的设计)中调用其中之一。

您可能还想查看磁盘上的入门手册,也可以在线获取。

祝你好运,

特里。

于 2013-09-09T15:23:39.120 回答