1.定义event事件时
这里专门为freeform表定义事件,只能针对数据窗口控制器dw_1
具体看图如下:
*特别要注意的是:Event ID选择的事件
2.代码:
*特别要注意的是:Event ID选择的事件
2.代码:
dw_1.accepttext( )
string ls_column_name
ls_column_name = This.GetColumnName()
if KeyDown(KeyF9!) or KeyDown(KeyEnter!) then
choose case lower(ls_column_name)
case "patient_id"
string ls_name,ls_sex,ls_patient_id
long ll_age,ll_count
date ld_brith
ls_patient_id = dw_1.object.patient_id[1]
//判断输入的病人ID是否存在
select count(*) into :ll_count from pat_master_index where patient_id = :ls_patient_id;
if ll_count = 0 then
messagebox('提示','你输入的病人不存在!')
return 0
end if
select name,date_of_birth,sex
into :ls_name,:ld_brith,:ls_sex
from pat_master_index
where patient_id = trim(:ls_patient_id);
//计算年龄
ll_age = year(today()) - year(ld_brith)
dw_1.object.name[1] = ls_name
dw_1.object.age[1] = string(ll_age)
dw_1.object.sex[1] = ls_sex
dw_1.SetColumn(5)
case "product_name"
//if KeyDown(KeyF9!) then
open(w_product_detail)
us_ylxq = message.powerobjectparm
dw_1.object.product_name[1] = us_ylxq.product_name
dw_1.object.trade_name[1] = us_ylxq.trade_name
dw_1.object.registra_no[1] = us_ylxq.registra_no
dw_1.object.company_name[1] = us_ylxq.company_name
dw_1.object.company_address[1] = us_ylxq.company_address
dw_1.object.company_phone[1] = us_ylxq.company_phone
dw_1.object.type_specific[1] = us_ylxq.type_specific
dw_1.object.model_no[1] = us_ylxq.model_no
dw_1.object.model_spec[1] = us_ylxq.model_spec
//end if
case else
return
end choose
end if