熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> SQL語言 >> 正文

在PB中如何實現數據模糊查詢(四)

2022-06-13   來源: SQL語言 
     StaticText: st_屬性

    X = Y = Width = Height =
    TabOrder = Visible = true Text = 請輸入查詢條件: TextColor =
    BackColor = Alignment = left! FillPattern = solid!

     CommandButton: cb_exit屬性

    X = Y = Width = Height =
    TabOrder = Visible = true Enabled = true Text = &F返回
    Cancel = true

     CommandButton: cb_exit的 clicked 事件

    功能直接退出

    Close(parent)

     CommandButton: cb_exec屬性

    X = Y = Width = Height =
    TabOrder = Visible = true Enabled = true Text = &Z執行
    Default = true

     CommandButton: cb_exec的 clicked 事件

    功能設置組和sql語法

    注釋n_cst_sqln_cst_sqlattrib為PFC中用戶對象這裡不再詳述

     DataWindow: dw_column屬性

    X = Y = Width = Height =
    TabOrder = Visible = true Enabled = true DataObject = d_column_set
    Border = true LiveScroll = true BorderStyle = stylebox

     DataWindow: dw_where屬性

    X = Y = Width = Height =
    TabOrder = Visible = true Enabled = true DataObject = d_where
    VScrollBar = true Border = true BorderStyle = stylelowered!

     DataWindow: dw_where的 editchanged 事件

    功能設置執行按鈕是否有效


     DataWindow: dw_where的itemchanged 事件

    功能見代碼中的注釋

    string colnamecolvalue logvalue
    long currow
    ib_changed = true
    cb_execEnabled = True
    currow = GetRow()
    If MaxEditRow < Currow Then MaxEditRow = currow
    // MaxEditRow 為當前已編輯過的最大行的行號實例變量
    colname = GetColumnName()
    colvalue = GetItemString(currowcolname)
    Choose Case dwoname
    Case dispvalue
    Objectvalue[row] = data
    Case Else
    End Choose
    //設置當前行的operator的初始值為=
    //設置上一行的logical的初始值為and
    if colname = column then
    if colvalue = or isnull(colvalue) then
    SetItem(currowoperator=)
    if currow >= then
    colvalue = GetItemString(currow colname)
    logvalue = GetItemString(currow logical)
    if colvalue <> and (logvalue = or isnull(logvalue)) then
    SetItem(currow logicaland)
    end if
    end if
    end if
    end if
    //檢查並設置左括號
    long ll i
    colvalue = GetText()
    if colname = precol then
    if colvalue <> and not isnull(colvalue) then
    ll = len(colvalue)
    colvalue =
    For i = to ll
    colvalue += (
    Next
    SetItem(currowprecolcolvalue)
    thisSettext(colvalue)
    Return
    end if
    end if

     DataWindow: dw_where的losefocus 事件

    AcceptText()

     DataWindow: dw_where的rbuttondown 事件

    功能設置彈出式菜單

    注釋

    () m_cpq_rbutton_paste菜單的屬性和代碼如下

    MenuItem = m_ a
    Visible = true Enabled = true
    MenuItems for m_
    MenuItem = m_value &V取現有值
    Visible = true Enabled = true
    Script for: nt clicked event
    long ll_pos
    String sSyntaxls_parmls_datals_disp
    datawindow dwp
    dwp = MessagePowerObjectParm
    sSyntax = MessageStringParm
    if sSyntax = or isNull(sSyntax) then
    beep()
    return
    end if
    OpenWithParm(w_pastesSyntax) //w_paste為響應式窗口
    ls_parm = MessageStringParm
    if ls_parm <> cancel then
    ll_pos = Pos ( ls_parm/)
    If ll_pos = Then
    ls_data = ls_parm
    ls_disp = ls_parm
    Else
    ls_data = Left ( ls_parm ll_pos )
    ls_disp = Mid ( ls_parm ll_pos + )
    End If
    dwpSetItem(dwpGetRow()valuels_data)
    dwpSetItem(dwpGetRow()dispvaluels_disp)
    dwpAcceptText()
    end if
     MenuItem = m_clear &D清除本列
    Visible = true Enabled = true
     Script for: clicked event
    datawindow dwp
    dwp = MessagePowerObjectParm
    dwpDeleteRow()
    dwpInsertRow()
    End of Script
    MenuItem = m_return &N返回
    Visible = true Enabled = true


From:http://tw.wingwit.com/Article/program/SQL/201311/16226.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.