您的位置:软件 > 开发者网络 > 开发工具 > 开发专栏 > PB > 正文
在PB中如何实现数据模糊查询
[文章信息]
作者:张爱生
时间:2003-07-30
出处:yesky
责任编辑:方舟
[文章导读]
本文主要介绍在PB中如何根据数据窗口中的字段对数据窗口进行模糊查询...
advertisement
热点推荐
· 天极网软件频道改版调查
· 在ASP.NET程序中创建唯一序号
· 用JVM工具接口创建调试和分析代理
· Win 2000如何安装配置防火墙
· 防范Windows消息钩子的侵入
[正文]

上一页  1 2 3 4 5 6 7  下一页

  9. DataWindow: dw_where属性:

X = 46 Y = 120 Width = 2459 Height = 448
TabOrder = 40 Visible = true Enabled = true DataObject = "d_where"
VScrollBar = true Border = true BorderStyle = stylelowered!

  9.1 DataWindow: dw_where的 editchanged 事件:

  功能:设置"执行"按钮是否有效。


  9.2 DataWindow: dw_where的itemchanged 事件:

  功能:见代码中的注释。

string colname,colvalue, logvalue
long currow
ib_changed = true
cb_exec.Enabled = True
currow = GetRow()
If MaxEditRow < Currow Then MaxEditRow = currow
// MaxEditRow 为当前已编辑过的最大行的行号。实例变量。
colname = GetColumnName()
colvalue = GetItemString(currow,colname)
Choose Case dwo.name
Case 'dispvalue'
Object.value[row] = data
Case Else
End Choose
//设置当前行的operator的初始值为"="
//设置上一行的logical的初始值为"and"
if colname = "column1" then
if colvalue = "" or isnull(colvalue) then
SetItem(currow,"operator","=")
if currow >= 2 then
colvalue = GetItemString(currow - 1,colname)
logvalue = GetItemString(currow - 1,"logical")
if colvalue <> "" and (logvalue = "" or isnull(logvalue)) then
SetItem(currow - 1,"logical","and")
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 = 1 to ll
colvalue += "("
Next
SetItem(currow,"precol",colvalue)
this.Settext(colvalue)
Return 2
end if
end if

  9.3 DataWindow: dw_where的losefocus 事件:

AcceptText()

  9.4 DataWindow: dw_where的rbuttondown 事件:

  功能:设置弹出式菜单。


  注释:

  (1) m_cpq_rbutton_paste菜单的属性和代码如下:

1.MenuItem = m_1 "a1"
Visible = true Enabled = true

2.MenuItems for m_1
MenuItem = m_value "&V.取现有值"
Visible = true Enabled = true

3.Script for: nt clicked event

long ll_pos
String sSyntax,ls_parm,ls_data,ls_disp
datawindow dwp
dwp = Message.PowerObjectParm
sSyntax = Message.StringParm
if sSyntax = "" or isNull(sSyntax) then
beep(3)
return
end if
OpenWithParm(w_paste,sSyntax) //w_paste为响应式窗口
ls_parm = Message.StringParm
if ls_parm <> "cancel" then
ll_pos = Pos ( ls_parm,'/')
If ll_pos = 0 Then
ls_data = ls_parm
ls_disp = ls_parm
Else
ls_data = Left ( ls_parm , ll_pos - 1 )
ls_disp = Mid ( ls_parm , ll_pos + 1 )
End If
dwp.SetItem(dwp.GetRow(),"value",ls_data)
dwp.SetItem(dwp.GetRow(),"dispvalue",ls_disp)
dwp.AcceptText()
end if

5. MenuItem = m_clear "&D.清除本列"
Visible = true Enabled = true

6. Script for: clicked event

datawindow dwp
dwp = Message.PowerObjectParm
dwp.DeleteRow(0)
dwp.InsertRow(0)
End of Script
MenuItem = m_return "&N.返回"
Visible = true Enabled = true



上一页  1 2 3 4 5 6 7  下一页

·"WAP天极之IT新闻资讯,50万元等你拿"    ·天极WAP之游戏狂图,50万元等你下载


发表评论推荐给朋友我想参加相关培训打印我对此感兴趣订阅电子杂志
相关内容阅读排行榜
  • 在PB 7.0中实现多数据窗口的连续打印
  • PB中数据窗口的精确页面打印技术
  • PowerBuilder数据窗口编程技巧十则
  • 实现PB数据窗口的多表更新
  • 将数据窗口保存为完整的Excel表格
  • 主板超频特色技术GIGA技嘉篇
  • Win 2000如何安装配置防火墙
  • 防范Windows消息钩子的侵入
  • 性价比之选 AGP显卡的告别秀
  • 大学校园生活之聊天也疯狂
  • Fireworks制作GIF动画Banner
  • 金山打击外挂 遭网络游戏玩家起诉
  • 完全公测《开天》掀起滔滔巨浪
  • Advertisement