在datawindow中的Button上调用事件

时间:2012-11-05 03:46:06

标签: button datawindow

我在数据窗口上放置了一个搜索按钮,我已经有了一个用于搜索此类列表的事件...如果在运行时单击该按钮,如何调用事件。

下面是名为“ue_key”

的活动代码
    string xcode, iseries, ycode, sql_statement, xname, i_cname, name, iseries_no, irequested_by, irequest_problem, irequesting_dept, idate_request, idate_needed
    string iasset_no, idate_received, istatus
    long i_row
    //integer 

    i_cname = dw_work_order.getcolumnname()
    i_row = this.getrow()
    if i_row > 0 then
        if key = keyF2! and i_cname = 'series_no' then

            //open(w_csearch)   
            //  Then, define select statement
            sql_statement = "SELECT series_no as 'Series NO', requested_by as 'Requested By' FROM work_order_form where status = 'A' or status = 'ACTIVE';"

            str_sellist args
            args.trans = sqlca
            args.sel_cmd = sql_statement

            //  Specify which column will be the return value
            args.retcol = 1

            //  Define drop-down items.  NOTE:  This should correspond
            //  with the alias you use for the columns you retrieve
            args.dropdown_items[1] = "Series NO"
            args.dropdown_items[2] = "Requested By"

            //  Define Search Window Title
            args.title = "Work Order"

            //  Define transaction object for the window
            //  This is REQUIRE for now...  :)


        //  Open with parameter
            OpenWithParm(w_sellist, args)
            ycode=message.stringparm

            xcode = ycode
        //  MessageBox('test', xcode)
            if trim(xcode) <> '' then

                    select   series_no, requested_by, request_problem, requesting_dept, date_request,date_needed, asset_no, status                                    
                    into        :iseries, :irequested_by, :irequest_problem, :irequesting_dept, :idate_request, :idate_needed, :iasset_no, :istatus
                    From work_order_form where series_no = :xcode using sqlca;


    //  Messagebox('test', iseries)
            this.setitem(THIS.GETROW(),'series_no', iseries)
            this.setitem(THIS.GETROW(),'requested_by', irequested_by)
            this.setitem(THIS.GETROW(),'request_problem', irequest_problem)
            this.setitem(THIS.GETROW(),'requesting_dept', irequesting_dept)
            this.setitem(THIS.GETROW(),'date_request', idate_request)
            this.setitem(THIS.GETROW(),'date_needed', idate_needed)
            this.setitem(THIS.GETROW(),'asset_no', iasset_no)
            this.setitem(THIS.GETROW(),'status', istatus)

    //dw_work_order.retrieve(iseries)

            end if
        end if
    end if

非常感谢!

1 个答案:

答案 0 :(得分:2)

datawindow控件具有“ButtonClicking”和“ButtonClicked”事件。您可以使用这些事件来识别单击了哪个按钮(检查事件参数,特别是dwo.Name)并调用相应的代码。

您需要确保数据窗口按钮的操作设置为“用户定义(0)”。