📄 jh12.prg
字号:
**************************************************
*-- 类: jh12 (e:\yh\user.vcx)
*-- 父类: form
*-- 基类: form
*
DEFINE CLASS jh12 AS form
Height = 247
Width = 582
DoCreate = .T.
AutoCenter = .T.
Caption = "设置查询条件"
Closable = .F.
MaxButton = .F.
MinButton = .F.
WindowType = 1
Name = "Form1"
ADD OBJECT shape1 AS shape WITH ;
Top = 14, ;
Left = 33, ;
Height = 211, ;
Width = 536, ;
FillStyle = 0, ;
SpecialEffect = 0, ;
FillColor = RGB(118,182,90), ;
Name = "Shape1"
ADD OBJECT label1 AS label WITH ;
AutoSize = .T., ;
FontBold = .T., ;
FontName = "楷体_GB2312", ;
FontSize = 14, ;
BackStyle = 0, ;
Caption = "条件1", ;
Height = 24, ;
Left = 63, ;
Top = 49, ;
Width = 56, ;
TabIndex = 12, ;
ForeColor = RGB(0,0,255), ;
Name = "Label1"
ADD OBJECT combo1 AS combobox WITH ;
FontSize = 11, ;
RowSourceType = 5, ;
RowSource = "fchar", ;
Height = 25, ;
Left = 123, ;
TabIndex = 2, ;
Top = 44, ;
Width = 109, ;
DisabledBackColor = RGB(255,128,128), ;
Name = "Combo1"
ADD OBJECT label2 AS label WITH ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 12, ;
BackStyle = 0, ;
Caption = "字 段", ;
Height = 20, ;
Left = 146, ;
Top = 21, ;
Width = 55, ;
TabIndex = 13, ;
ForeColor = RGB(0,0,255), ;
Name = "Label2"
ADD OBJECT combo2 AS combobox WITH ;
Comment = "", ;
FontSize = 11, ;
ColumnWidths = "60", ;
RowSourceType = 1, ;
RowSource = "<,<=,>,>=,=,==,<>", ;
Height = 25, ;
Left = 243, ;
TabIndex = 3, ;
Top = 45, ;
Width = 73, ;
DisabledBackColor = RGB(255,128,128), ;
Name = "Combo2"
ADD OBJECT text1 AS textbox WITH ;
FontSize = 11, ;
Height = 25, ;
Left = 327, ;
TabIndex = 4, ;
Top = 45, ;
Width = 94, ;
DisabledBackColor = RGB(255,128,128), ;
Name = "Text1"
ADD OBJECT label3 AS label WITH ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 12, ;
BackStyle = 0, ;
Caption = "比较符", ;
Height = 20, ;
Left = 247, ;
Top = 21, ;
Width = 54, ;
TabIndex = 14, ;
ForeColor = RGB(0,0,255), ;
Name = "Label3"
ADD OBJECT label4 AS label WITH ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 12, ;
BackStyle = 0, ;
Caption = "比较值", ;
Height = 20, ;
Left = 347, ;
Top = 21, ;
Width = 54, ;
TabIndex = 15, ;
ForeColor = RGB(0,0,255), ;
Name = "Label4"
ADD OBJECT label5 AS label WITH ;
AutoSize = .T., ;
FontBold = .T., ;
FontName = "楷体_GB2312", ;
FontSize = 14, ;
BackStyle = 0, ;
Caption = "条件2", ;
Height = 24, ;
Left = 64, ;
Top = 149, ;
Width = 56, ;
TabIndex = 16, ;
ForeColor = RGB(0,0,255), ;
Name = "Label5"
ADD OBJECT combo3 AS combobox WITH ;
FontSize = 11, ;
RowSourceType = 5, ;
RowSource = "fchar", ;
Enabled = .F., ;
Height = 25, ;
Left = 124, ;
TabIndex = 6, ;
Top = 144, ;
Width = 109, ;
DisabledBackColor = RGB(255,128,128), ;
Name = "Combo3"
ADD OBJECT label6 AS label WITH ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 12, ;
BackStyle = 0, ;
Caption = "字 段", ;
Height = 20, ;
Left = 147, ;
Top = 121, ;
Width = 55, ;
TabIndex = 9, ;
ForeColor = RGB(0,0,255), ;
Name = "Label6"
ADD OBJECT combo4 AS combobox WITH ;
FontSize = 11, ;
RowSourceType = 1, ;
RowSource = "<,<=,>,>=,=,==,<>", ;
Enabled = .F., ;
Height = 25, ;
Left = 244, ;
TabIndex = 7, ;
Top = 145, ;
Width = 73, ;
DisabledBackColor = RGB(255,128,128), ;
Name = "Combo4"
ADD OBJECT text2 AS textbox WITH ;
FontSize = 11, ;
Enabled = .F., ;
Height = 25, ;
Left = 328, ;
TabIndex = 8, ;
Top = 145, ;
Width = 94, ;
DisabledBackColor = RGB(255,128,128), ;
Name = "Text2"
ADD OBJECT label7 AS label WITH ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 12, ;
BackStyle = 0, ;
Caption = "比较符", ;
Height = 20, ;
Left = 248, ;
Top = 121, ;
Width = 54, ;
TabIndex = 10, ;
ForeColor = RGB(0,0,255), ;
Name = "Label7"
ADD OBJECT label8 AS label WITH ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 12, ;
BackStyle = 0, ;
Caption = "比较值", ;
Height = 20, ;
Left = 348, ;
Top = 121, ;
Width = 54, ;
TabIndex = 11, ;
ForeColor = RGB(0,0,255), ;
Name = "Label8"
ADD OBJECT opg1 AS optiongroup WITH ;
ButtonCount = 2, ;
BackStyle = 0, ;
Value = 0, ;
Height = 37, ;
Left = 156, ;
Top = 76, ;
Width = 176, ;
TabIndex = 5, ;
Name = "opg1", ;
Option1.FontBold = .T., ;
Option1.FontSize = 16, ;
Option1.BackStyle = 0, ;
Option1.Caption = "与", ;
Option1.Value = 0, ;
Option1.Height = 26, ;
Option1.Left = 12, ;
Option1.Top = 8, ;
Option1.Width = 51, ;
Option1.AutoSize = .T., ;
Option1.ForeColor = RGB(255,0,0), ;
Option1.Name = "Option1", ;
Option2.FontBold = .T., ;
Option2.FontSize = 16, ;
Option2.BackStyle = 0, ;
Option2.Caption = "或", ;
Option2.Height = 26, ;
Option2.Left = 91, ;
Option2.Top = 7, ;
Option2.Width = 51, ;
Option2.AutoSize = .T., ;
Option2.ForeColor = RGB(255,0,0), ;
Option2.Name = "Option2"
ADD OBJECT label9 AS label WITH ;
AutoSize = .T., ;
FontBold = .T., ;
FontName = "楷体_GB2312", ;
FontSize = 16, ;
BackStyle = 0, ;
Caption = "连接关系", ;
Height = 26, ;
Left = 56, ;
Top = 88, ;
Width = 95, ;
TabIndex = 17, ;
ForeColor = RGB(0,0,255), ;
Name = "Label9"
ADD OBJECT command2 AS commandbutton WITH ;
Top = 186, ;
Left = 114, ;
Height = 31, ;
Width = 68, ;
FontBold = .T., ;
FontName = "楷体_GB2312", ;
FontSize = 18, ;
Caption = "确定", ;
TabIndex = 20, ;
ForeColor = RGB(255,0,0), ;
Name = "Command2"
ADD OBJECT command4 AS commandbutton WITH ;
Top = 186, ;
Left = 318, ;
Height = 31, ;
Width = 68, ;
FontBold = .T., ;
FontName = "楷体_GB2312", ;
FontSize = 18, ;
Caption = "取消", ;
TabIndex = 21, ;
ForeColor = RGB(255,0,0), ;
Name = "Command4"
ADD OBJECT command3 AS commandbutton WITH ;
Top = 186, ;
Left = 215, ;
Height = 31, ;
Width = 68, ;
FontBold = .T., ;
FontName = "楷体_GB2312", ;
FontSize = 18, ;
Caption = "重置", ;
TabIndex = 22, ;
ForeColor = RGB(255,0,0), ;
Name = "Command3"
ADD OBJECT label12 AS label WITH ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 10, ;
BackStyle = 0, ;
Caption = "", ;
Height = 17, ;
Left = 427, ;
Top = 49, ;
Width = 2, ;
ForeColor = RGB(255,0,0), ;
Name = "Label12"
ADD OBJECT label13 AS label WITH ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 10, ;
BackStyle = 0, ;
Caption = "", ;
Height = 17, ;
Left = 431, ;
Top = 149, ;
Width = 2, ;
ForeColor = RGB(255,0,0), ;
Name = "Label13"
ADD OBJECT label14 AS label WITH ;
FontBold = .T., ;
FontName = "楷体_GB2312", ;
FontSize = 18, ;
WordWrap = .T., ;
Caption = "设置条件", ;
Height = 108, ;
Left = 7, ;
Top = 58, ;
Width = 25, ;
TabIndex = 24, ;
ForeColor = RGB(255,0,0), ;
Name = "Label14"
PROCEDURE creatcond
lparameters fno, fvalue
fieldn=fname(fno)
fieldtype = ftype(fno)
do case
case fieldtype $ "CM" &&字符型和备注型
fvalue = CHR(34) + alltrim(fvalue) + CHR(34)
case fieldtype $ "DT" &&日期型和时间型
fvalue = "CTOD('" + alltrim(fvalue) + "')"
case fieldtype $ "NY" &&数值型
if empty(fvalue)
fvalue = "0"
endif
case fieldtype $ "L" &&逻辑型
if !inlist(upper(fvalue), ".T.", ".F.")
fvalue = ".T."
endif
endcase
return fvalue
ENDPROC
PROCEDURE Init
thisform.combo1.value=0
thisform.combo3.value=0
thisform.combo1.enabled=.T.
thisform.combo2.enabled=.T.
thisform.text1.enabled=.T.
ENDPROC
PROCEDURE combo1.InteractiveChange
thisform.command2.enabled=.T.
thisform.command3.enabled=.T.
ENDPROC
PROCEDURE combo1.LostFocus
thisform.combo2.value="="
ENDPROC
PROCEDURE text1.When
vtype=ftype(thisform.combo1.value)
do case
case vtype$"D"
thisform.label12.caption="<=日期格式:年.月.日"
case vtype$"C"
thisform.label12.caption="<=字符型值"
case vtype$"N"
thisform.label12.caption="<=数值型值"
case vtype$"L"
thisform.label12.caption="<=逻辑型值"
endcase
ENDPROC
PROCEDURE text1.LostFocus
thisform.label12.caption=""
ENDPROC
PROCEDURE combo3.LostFocus
thisform.combo4.value="="
ENDPROC
PROCEDURE text2.LostFocus
thisform.label13.caption=""
ENDPROC
PROCEDURE text2.When
vtype=ftype(thisform.combo3.value)
do case
case vtype$"D"
thisform.label13.caption="<=日期格式:年.月.日"
case vtype$"C"
thisform.label13.caption="<=字符型值"
case vtype$"N"
thisform.label13.caption="<=数值型值"
case vtype$"L"
thisform.label13.caption="<=逻辑型值"
endcase
ENDPROC
PROCEDURE opg1.InteractiveChange
thisform.combo3.enabled=.T.
thisform.combo4.enabled=.T.
thisform.text2.enabled=.T.
ENDPROC
PROCEDURE command2.Click
if thisform.combo1.value=0
if messagebox("没有设置任何条件,查询所有的记录",48+1,"信息提示")=1
set filter to .t.
thisform.release
endif
return
else
if thisform.opg1.value > 0 and thisform.combo3.value=0
=messagebox("设置的查询条件2不完整",48,"信息提示")
return
endif
endif
cond=fname(thisform.combo1.value)+thisform.combo2.value+ ;
thisform.creatcond(thisform.combo1.value,thisform.text1.value)
do case
case thisform.opg1.value = 0
lcOperand = ""
case thisform.opg1.value = 1
cond=cond+" AND "
case thisform.opg1.value = 2
cond=cond+" OR "
endcase
if thisform.opg1.value<>0
cond=cond+fname(thisform.combo3.value)+;
thisform.combo4.value+thisform.creatcond(thisform.combo3.value,thisform.text2.value)
endif
testcond=0
on error testcond=1 &&当过滤语句不正确时,执行testcond=1
set filter to &cond
if testcond=1
=messagebox("设置的查询条件不正确",48,"信息提示")
return
endif
go top
thisform.release
ENDPROC
PROCEDURE command4.Click
thisform.release
ENDPROC
PROCEDURE command3.Click
thisform.combo1.value = ""
thisform.combo2.value = ""
thisform.combo3.value = ""
thisform.combo4.value = ""
thisform.text1.value=""
thisform.text2.value=""
thisform.combo3.enabled=.F.
thisform.combo4.enabled=.F.
thisform.text2.enabled=.F.
thisform.opg1.value=0
thisform.command2.enabled=.F.
ENDPROC
ENDDEFINE
*
*-- 结束定义: jh12
**************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -