button - 在数据窗口中的按钮上调用事件

标签 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

非常感谢!

最佳答案

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

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

关于button - 在数据窗口中的按钮上调用事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13225655/

相关文章:

android - 音乐键问题

powerbuilder - 如何在PowerBuilder的DataWindow中下拉

powerbuilder - 当列值为零时,如何在数据窗口中隐藏列的显示值

powerbuilder - 数据窗口中的特定列不可编辑

android - 如何在应用程序中添加通知徽章?

WPF 按钮命令绑定(bind)已刷新,但按钮仍处于禁用状态

pdf - 在 PB 10.5 中将数据窗口保存为 PDF

数据窗口中的 Catel 取消按钮

android - 如何在 android 4.0 ICS 中启用底部菜单按钮

button - 从 VS 2012 导入设置后,Visual Studio 2013 缩进按钮变灰(不起作用)