浏览器中的价值变化事件?

时间:2012-04-12 10:44:46

标签: progress-4gl openedge

define variable hOrderQuery     as handle no-undo.
define variable browseOrder-hdl as handle no-undo.
define variable browse-hdl      as handle  no-undo.
define variable CNumber         as integer no-undo.

CREATE QUERY hQuery.
hQuery:SET-BUFFERS(BUFFER Customer:HANDLE).
hQuery:QUERY-PREPARE("FOR EACH Customer").
hQuery:QUERY-OPEN().

CREATE BROWSE browse-hdl
ASSIGN
TITLE     = "Customer Browser"
FRAME     = FRAME MyFrame:HANDLE
QUERY     = hQuery
X         = 2
Y         = 2
WIDTH     = 74
DOWN      = 10
VISIBLE   = YES
SENSITIVE = TRUE
READ-ONLY = yes.
browse-hdl:ADD-COLUMNS-FROM(BUFFER Customer:HANDLE,"SalesRep,email,fax,comments,address,City,State,PostalCode").


on value-changed of browse-hdl
do:

FIND CURRENT Customer.
cNumber = Customer.CustNum.

CREATE QUERY hOrderQuery.
hOrderQuery:SET-BUFFERS(BUFFER Order:HANDLE).
hOrderQuery:QUERY-PREPARE("FOR EACH Order where Order.CustNum = " + string(cNumber)) no-    error.
hOrderQuery:QUERY-OPEN().

CREATE BROWSE browseOrder-hdl
ASSIGN
TITLE     = "Order Browser"
FRAME     = FRAME MyFrame:HANDLE
QUERY     = hOrderQuery
X         = 2
Y         = 240
WIDTH     = 74
DOWN      = 10
VISIBLE   = YES
SENSITIVE = TRUE
READ-ONLY = yes.
browseOrder-hdl:ADD-COLUMNS-FROM(BUFFER Order:HANDLE,"warehousenum,CustNum").

end.


on value-changed of browseOrder-hdl
do:
message "hai" view-as alert-box.
end.

这是我的问题。我有3个浏览器。现在我只创建了两个。当我点击第一个客户浏览器的一行时,它应该选择当前客户并且应该在第二个浏览器顺序浏览器中显示他的订单。 当我点击订单浏览器值时,它应该在第三个订单行浏览器中显示相应的订单行表值(我现在没有创建)。

因此,当我尝试使用browseOrder-hdl创建第二个值更改事件时,它显示它已被删除。 如何克服这个问题?请回复。

1 个答案:

答案 0 :(得分:0)

DEFINE FRAME MyFrame
  WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY 
  SIDE-LABELS NO-UNDERLINE THREE-D 
  AT COL 1 ROW 1
  SIZE 80 BY 16.

define variable hOrderQuery     as handle  no-undo.
define variable browseOrder-hdl as handle  no-undo.
define variable browse-hdl      as handle  no-undo.
define variable CNumber         as integer no-undo.
DEFINE VARIABLE hQuery          AS HANDLE  NO-UNDO.

CREATE QUERY hQuery.
hQuery:SET-BUFFERS(BUFFER Customer:HANDLE).
hQuery:QUERY-PREPARE("FOR EACH Customer").
hQuery:QUERY-OPEN().

CREATE BROWSE browse-hdl
  ASSIGN
  TITLE     = "Customer Browser"
  FRAME     = FRAME MyFrame:HANDLE
  QUERY     = hQuery
  X         = 2
  Y         = 2
  WIDTH     = 74
  DOWN      = 10
  VISIBLE   = TRUE
  SENSITIVE = TRUE
  READ-ONLY = TRUE
  TRIGGERS:
    ON VALUE-CHANGED DO:
      RUN ShowOrderBrowser.
    END.  
  END.  

  browse-hdl:ADD-COLUMNS-FROM(BUFFER Customer:HANDLE,"SalesRep,email,fax,comments,address,City,State,PostalCode").



WAIT-FOR CLOSE OF THIS-PROCEDURE.



/* **********************  Internal Procedures  *********************** */

PROCEDURE ShowOrderBrowser:
  /*------------------------------------------------------------------------------
      Purpose:                                                                        
      Notes:                                                                      
  ------------------------------------------------------------------------------*/
  FIND CURRENT Customer.
  cNumber = Customer.CustNum.

  CREATE QUERY hOrderQuery.
  hOrderQuery:SET-BUFFERS(BUFFER Order:HANDLE).
  hOrderQuery:QUERY-PREPARE("FOR EACH Order WHERE Order.CustNum = " + STRING(cNumber)).
  hOrderQuery:QUERY-OPEN().

  CREATE BROWSE browseOrder-hdl
    ASSIGN
    TITLE     = "Order Browser"
    FRAME     = FRAME MyFrame:HANDLE
    QUERY     = hOrderQuery
    X         = 2
    Y         = 240 
    WIDTH     = 74
    DOWN      = 10
    VISIBLE   = TRUE
    SENSITIVE = TRUE
    READ-ONLY = TRUE    
    TRIGGERS:
      ON VALUE-CHANGED DO:
        MESSAGE "hai"
        VIEW-AS ALERT-BOX.
      END.
    END.

  browseOrder-hdl:ADD-COLUMNS-FROM(BUFFER Order:HANDLE,"warehousenum,CustNum").  

  WAIT-FOR VALUE-CHANGED OF browseOrder-hdl.

END PROCEDURE.