pfc中右键服务开启,可以设置很多的功能,应该是依据控件而定的。
那么如何在右键菜单中添加自定义菜单项
在datawindow的pfc_prembmenu(ref m_dw am_dw) 添加
对应的菜单即可,如:
am_dw.m_table.m_restorerow.enabled=false
am_dw.m_table.m_restorerow.visible=false
am_dw.m_table.m_delete.enabled=true
am_dw.m_table.m_delete.visible=true
am_dw.m_table.m_delete.text='采购员查询'
am_dw.m_table.m_insert.enabled=true
am_dw.m_table.m_insert.text='全选'
am_dw.m_table.m_addrow.enabled=true
am_dw.m_table.m_addrow.text='分配给采购员'
然后在对应的pfc_delete()
pfc_insert()
pfc_addrow() 中添加相应的代码
example:=========================================
string ls_mtrl_no,ls_mtrl_name,ls_buyer
integer li_row,li_insert,li_rec,li_temp,li_num=0,ls_bz
long ll_tvi
ls_buyer=dw_2.object.emp_no[dw_2.getrow()]
if ls_buyer='' or isnull(ls_buyer) then
messagebox("提示","没有选择采购员")
dw_mtrl.setrow(1)
dw_mtrl.drag(end!)
return -1
end if
li_temp=dw_mtrl.getselectedrow(0)
do while li_temp > 0
li_num++
ls_bz=dw_mtrl.object.compute[li_temp]
if ls_bz=1 then
messagebox("提示","该选择里包含有已分配的物资,请重新选择一次")
return -1
end if
li_temp=dw_mtrl.getselectedrow(li_temp)
loop
if messagebox("提示","总共有"+string(li_num)+"种物资要分配给采购员,确认吗?Y/N",information!,yesno!,1)=2 then
return -1
end if
li_row=dw_mtrl.getselectedrow(0)
do while li_row > 0
ls_mtrl_no=dw_mtrl.object.materialid[li_row]
ls_mtrl_name=dw_mtrl.object.materialname[li_row]
li_insert=dw_buyer.insertrow(0)
dw_buyer.object.mtrl_no[li_insert]=ls_mtrl_no
dw_buyer.object.ware_no[li_insert]='A'
dw_buyer.object.staff_no[li_insert]=ls_buyer
dw_buyer.object.materialname[li_insert]=ls_mtrl_name
dw_buyer.scrolltorow(li_insert)
dw_mtrl.object.staff_no[li_row]=ls_buyer
li_row=dw_mtrl.getselectedrow(li_row)
loop
li_rec=parent.event pfc_save()
if li_rec < 1 then
messagebox("提示","保存失败")
dw_buyer.retrieve(ls_buyer)
// ll_tvi = tv_1.FindItem(currenttreeitem! , 0)
// tv_1.event ue_retrieve(ll_tvi)
end if
return 1