pb数据窗口数据输入的下拉选择效果
2011-11-07 16:16
211 查看
1.建立子数据窗口.
2.在dw_1.editchanged中写如类似下面代码
if row <=0 then return
DataWindowChild state_child
accepttext( )
string ls_value,partname,cartype
long findIndex
if dwo.name = "partno" then
GetChild("partno", state_child)
state_child.accepttext( )
ls_value = trim(getitemstring(row,"partno"))
state_child.SetTransObject(SQLCA)
state_child.Retrieve()
state_child.setfilter( "p_partno like '%"+ls_value+"%' ")
state_child.filter( )
end if
3.在dw_1.itemchanged中写如下代码
dw_1.event itemfocuschanged( row, dwo)
因为acceptText()会触犯,itemchanged事件,所以不能在itemchanged事件中写acceptText()
4.在itemfocuschanged中写如下代码
if row <=0 then return
if dwo.name="partno" then
accepttext( )
string partno,partname,cartype
partno = trim(dw_1.getitemstring(row,"partno"));
select p_partname,p_yw into:partname,:cartype from p_partno
where p_partno=:partno;
commit;
dw_1.setitem( row, "partname", partname);
dw_1.setitem( row, "cartype", cartype);
accepttext( )
end if
5.回车键代替Tab件,需要给dw_1建立个用户自定义事件
6.将使用setitem设置的列tab设置成0
*********************改进措施*****************************
申明窗体变量partno_ds
在open事件中填充partno_ds
string cmdText
cmdText="SELECT p_partno Partno,p_partName PartName,p_yw CarType " + &
" from p_partno where (p_partno <> '' AND p_partno is not null and p_partno >'-') " + &
" order by p_partno";
partno_ds= gf_fill_ds(cmdText);
调整editchanged事件代码为使用sharedata方式
if row <=0 then return
DataWindowChild state_child
accepttext( )
string ls_value;
long findIndex
if dwo.name = "partno" then
GetChild("partno", state_child)
state_child.accepttext( )
ls_value = trim(getitemstring(row,"partno"))
partno_ds.sharedata( state_child)
if not isnull(ls_value) and trim( ls_value) <> '' then
state_child.setfilter( "partno like '%"+ls_value+"%' ")
else
state_child.setfilter("")
end if
state_child.filter( );
end if
调整itemfocuschange事件为datastore查找
if row <=0 then return
if dwo.name="partno" then
accepttext( )
long findIndex
string partno,partname,cartype
partno = trim(dw_1.getitemstring(row,"partno"));
findIndex=partno_ds.find( "partno='"+ partno+"'",1, partno_ds.rowcount( ) );
if(findIndex>=1 ) then
partname=partno_ds.getitemstring( findIndex,"partname")
cartype=partno_ds.getitemstring( findIndex, "cartype")
dw_1.setitem( row, "partname", partname);
dw_1.setitem( row, "cartype", cartype);
accepttext( )
end if
end if
2.在dw_1.editchanged中写如类似下面代码
if row <=0 then return
DataWindowChild state_child
accepttext( )
string ls_value,partname,cartype
long findIndex
if dwo.name = "partno" then
GetChild("partno", state_child)
state_child.accepttext( )
ls_value = trim(getitemstring(row,"partno"))
state_child.SetTransObject(SQLCA)
state_child.Retrieve()
state_child.setfilter( "p_partno like '%"+ls_value+"%' ")
state_child.filter( )
end if
3.在dw_1.itemchanged中写如下代码
dw_1.event itemfocuschanged( row, dwo)
因为acceptText()会触犯,itemchanged事件,所以不能在itemchanged事件中写acceptText()
4.在itemfocuschanged中写如下代码
if row <=0 then return
if dwo.name="partno" then
accepttext( )
string partno,partname,cartype
partno = trim(dw_1.getitemstring(row,"partno"));
select p_partname,p_yw into:partname,:cartype from p_partno
where p_partno=:partno;
commit;
dw_1.setitem( row, "partname", partname);
dw_1.setitem( row, "cartype", cartype);
accepttext( )
end if
5.回车键代替Tab件,需要给dw_1建立个用户自定义事件
6.将使用setitem设置的列tab设置成0
*********************改进措施*****************************
申明窗体变量partno_ds
在open事件中填充partno_ds
string cmdText
cmdText="SELECT p_partno Partno,p_partName PartName,p_yw CarType " + &
" from p_partno where (p_partno <> '' AND p_partno is not null and p_partno >'-') " + &
" order by p_partno";
partno_ds= gf_fill_ds(cmdText);
调整editchanged事件代码为使用sharedata方式
if row <=0 then return
DataWindowChild state_child
accepttext( )
string ls_value;
long findIndex
if dwo.name = "partno" then
GetChild("partno", state_child)
state_child.accepttext( )
ls_value = trim(getitemstring(row,"partno"))
partno_ds.sharedata( state_child)
if not isnull(ls_value) and trim( ls_value) <> '' then
state_child.setfilter( "partno like '%"+ls_value+"%' ")
else
state_child.setfilter("")
end if
state_child.filter( );
end if
调整itemfocuschange事件为datastore查找
if row <=0 then return
if dwo.name="partno" then
accepttext( )
long findIndex
string partno,partname,cartype
partno = trim(dw_1.getitemstring(row,"partno"));
findIndex=partno_ds.find( "partno='"+ partno+"'",1, partno_ds.rowcount( ) );
if(findIndex>=1 ) then
partname=partno_ds.getitemstring( findIndex,"partname")
cartype=partno_ds.getitemstring( findIndex, "cartype")
dw_1.setitem( row, "partname", partname);
dw_1.setitem( row, "cartype", cartype);
accepttext( )
end if
end if
相关文章推荐
- pb数据窗口数据输入的下拉选择效果
- 【QTP学习笔记 1 】下拉框数据随机选择,日期输入,如何获取动态的对话框
- PB数据窗口中DDDW下拉关联实现
- PB数据窗口modify修改字段下拉属性
- 怎么样在PB的数据窗口中一输入一个汉字就自动的取出它的拼音字母的第一个
- PB数据窗口中字段下拉窗口的setfile
- PB中相关联下拉数据窗口的实现
- pb数据窗口输入问题
- pb数据窗口下拉数据窗口列的排序(翻译)
- PB数据窗口中代码列动态选择两法
- PB中得到下拉数据窗口的显示
- pb 数据窗口下拉表
- pb数据窗口如何按当前列的值过滤下拉数据窗口(翻译)
- 【PB】动态添加数据窗口列中下拉列表的内容
- 在PB中巧用下拉数据窗口
- 【转】【PB】动态添加数据窗口列中下拉列表的内容
- 转:zTree树控件扩展篇:巧用zTree控件实现文本框输入关键词自动模糊查找zTree树节点实现模糊匹配下拉选择效果
- 如何点击按钮弹出新窗口,输入数据后返回并刷新页面?
- PB中数据窗口的函数小结
- 自定义弹出窗口,实现可输入可过滤自动选择下拉框