我做了一个类似于 ATM 上的那样一个程序 只能用小键盘 输入数字
输入完数字后
回车
就可以查询出年份并且显示在一个ddlb_1里面
但是哦什么 用光标上下键 没办法选择(为什么不能用光标选择)
以下是我程序中代码()
/////小键盘操作,自定义事件
//小键盘模拟
ddlb_1.reset()//初始化
choose case key
case KeyNumpad0!
sle_1.text=sle_1.text + '0'
case KeyNumpad1!
sle_1.text=sle_1.text + '1'
case KeyNumpad2!
sle_1.text=sle_1.text + '2'
case KeyNumpad3!
sle_1.text=sle_1.text + '3'
case KeyNumpad4!
sle_1.text=sle_1.text + '4'
case KeyNumpad5!
sle_1.text=sle_1.text + '5'
case KeyNumpad6!
sle_1.text=sle_1.text + '6'
case KeyNumpad7!
sle_1.text=sle_1.text + '7'
case KeyNumpad8!
sle_1.text=sle_1.text + '8'
case KeyNumpad9!
sle_1.text=sle_1.text + '9'
case KeyDecimal! //小数点模拟H
sle_1.text='H'
case KeyPageUp!
Send(Handle(this),256,38,Long(0,0)) //光标上
return 1 ;
case KeyPageDown!
Send(Handle(this),256,40,Long(0,0)) //光标下
return 1 ;
case KeyEnter!
string ls_tmp_cursor_date
declare cursor_year cursor for
select a.instfrom
from ipe_linsinfo a ,IPE_CNTTYPE b, ipe_chdrinfo c,clntpf d
where a.company='L'
and a.statcode='IF'
and a.chdrnum=:sle_1.text
and c.company='L'
and c.validflag='1'
and c.statcode='IF'
and d.clntcoy='9'
and d.validflag='1'
and c.chdrnum =a.chdrnum
and c.cownnum=d.clntnum
and c.cnttype=b.descitem
and a.payflag='P'
and a.instfrom >=year(CURRENT_DATE)
order by a.instfrom desc ;
open cursor_year;
do while true
fetch cursor_year into :cursor_class;
if sqlca.sqlcode = 100 or sqlca.sqlcode = -1 then
exit
end if
ls_tmp_cursor_date=mid(cursor_class,1,4)
cursor_class=ls_tmp_cursor_date//+"年度"
ddlb_2.additem(cursor_class)
loop
close cursor_year;
ddlb_2.setfocus()
// Send(Handle(this),256,9,Long(0,0)) //发送TAB键
// return 1 ; //取消原ENTER键的动作
string ls_year
ls_year=string(today(),'YYYY')
ddlb_2.additem(ls_year)
cb_1.visible=false
cb_2.visible=true
cb_3.visible=true
cb_4.visible=true
cb_5.visible=true
cb_6.visible=true
end choose
//////////这个是ddb_2的modified事件
string ls_Money
long ls_dot
double tmp
integer ls_len
integer i
string ls_money_tmp
string ls_dx
//初始
ls_begin_date=""
ls_end_date=""
ls_begin_date1=0
ls_end_date1=0
ls_begin_date=ddlb_1.text + '0101'
ls_end_date=ddlb_1.text + '1201'
ls_begin_date1=long(ls_begin_date)
ls_end_date1=long(ls_end_date)
dw_1.reset()
if dw_1.retrieve(sle_1.text,ls_begin_date,ls_end_date,ls_begin_date1,ls_end_date1) = 0 then
st_2.visible=true //没有数据 显示框
LS_print_ym='N'
else
st_2.visible=false
LS_print_ym='Y'
tmp =dw_1.object.instamt06 [dw_1.getrow()] //小写金额
//gs_Start=dw_1.object.qs [dw_1.getrow()] //开始日期
//gs_End=dw_1.object.js [dw_1.getrow()] //结束日期
// messagebox("",rmbconversion(tmp))
// gs_jiner=rmbconversion(tmp) //大写金额
end if
//messagebox("",ls_begin_date )
// ls_begin_date=""
// ls_end_date=""
// ls_begin_date1=0
// ls_end_date1=0
/////////////////////////////////////这个是ddlb_2的自定义键盘响应事件
if key = keyenter! and ddlb_1.text<>"" and LS_print_ym='Y'then
// ls_msg = MessageBox("发票打印","要打印吗", Exclamation!, OKCancel!, 2)
// IF ls_msg = 1 THEN
dw_1.visible=false//隐藏明细