1.怎样加入根节点,(应该不是tv_1.insertitem(0,tvi_item)吧)
2.怎样加入节点(我不用pfc实现是用item的data记录部门号,然后建立一个datastore专门找他的子部门,在itempopulate事件中把它子节点加入)不知道用pfc怎样实现。
顺便问一下,pb9.0用没有自带的例子?
10 个解决方案
#1
从不用PFC.帮顶.
#2
难道没有人用pfc了吗,这么多天没有人回了
#3
举个例子:constructure事件
// 清除原有的树形列表
of_setlevelsource(false)
do while finditem(RootTreeItem!,0) <> -1
of_reset()
loop
// 生成新的树形列表
of_setbase(true)
of_setlevelsource(true)
ib_rmbmenu = false
integer li_rc
long ll_firstitemonlevel,ll_count
string ls_msg
// 第一层
li_rc = this.inv_levelsource.of_Register(&
1, "category",'', sqlca, 'select ~'所有分类~' as category ' ,"")
if li_rc <> 1 then
ls_msg = '第一层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(1, "1")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(1, "1")
// 第二层
li_rc = this.inv_levelsource.of_Register(&
2, "category",'', "d_category_1", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第二层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(2, "2")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(2, "2")
//
// 第三层
li_rc = this.inv_levelsource.of_Register(&
3, "category", ":parent.1.categorycode", "d_category_2", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第三层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(3, "3")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(3, "3")
// 第四层
li_rc = this.inv_levelsource.of_Register(&
4, "category", ":parent.1.categorycode", "d_category_3", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第三层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(4, "4")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(4, "4")
// 第五层
li_rc = this.inv_levelsource.of_Register(&
5, "category", ":parent.1.categorycode", "d_category_4", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第四层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(5, "5")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(5, "5")
li_rc = this.event pfc_populate(0)
ll_firstitemonlevel = this.inv_base.of_FindFirstItemLevel(1, 0)
this.ExpandItem(ll_FirstItemOnLevel)
this.SelectItem(ll_firstitemonlevel)
return
err_exit:
messagebox('错误',ls_msg,StopSign!)
// 清除原有的树形列表
of_setlevelsource(false)
do while finditem(RootTreeItem!,0) <> -1
of_reset()
loop
// 生成新的树形列表
of_setbase(true)
of_setlevelsource(true)
ib_rmbmenu = false
integer li_rc
long ll_firstitemonlevel,ll_count
string ls_msg
// 第一层
li_rc = this.inv_levelsource.of_Register(&
1, "category",'', sqlca, 'select ~'所有分类~' as category ' ,"")
if li_rc <> 1 then
ls_msg = '第一层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(1, "1")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(1, "1")
// 第二层
li_rc = this.inv_levelsource.of_Register(&
2, "category",'', "d_category_1", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第二层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(2, "2")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(2, "2")
//
// 第三层
li_rc = this.inv_levelsource.of_Register(&
3, "category", ":parent.1.categorycode", "d_category_2", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第三层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(3, "3")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(3, "3")
// 第四层
li_rc = this.inv_levelsource.of_Register(&
4, "category", ":parent.1.categorycode", "d_category_3", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第三层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(4, "4")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(4, "4")
// 第五层
li_rc = this.inv_levelsource.of_Register(&
5, "category", ":parent.1.categorycode", "d_category_4", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第四层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(5, "5")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(5, "5")
li_rc = this.event pfc_populate(0)
ll_firstitemonlevel = this.inv_base.of_FindFirstItemLevel(1, 0)
this.ExpandItem(ll_FirstItemOnLevel)
this.SelectItem(ll_firstitemonlevel)
return
err_exit:
messagebox('错误',ls_msg,StopSign!)
#4
学习2009年10月14日21时55分30秒
#5
pfc本身带有例程,你没有吗?
#6
pfc帮助文件中也写的很详细
Library
PFCAPSRV.PBL
PFEAPSRV.PBL
Object relationships
n_cst_dwcache
n_cst_tvsrvattrib
n_ds
n_tr
Usage
To use this object:
1 Enable the service using the u_tvs of_SetLevelSource function:
this.of_SetLevelSource(TRUE)
2 Define a data source for each TreeView level by calling the of_Register function, once for each level:
this.inv_levelsource.of_Register(1, &
"dept_name", "", "d_deptlist", SQLCA, "")
this.inv_levelsource.of_Register(2, "emp_lname", &
":parent.1.dept_id", "d_empbydept", SQLCA, "")
3 Call additional functions as needed to control TreeView behavior:
this.inv_levelsource.of_SetPictureColumn(1, "1")
this.inv_levelsource.of_SetSelectedPictureColumn &
(1, "2")this.inv_levelsource.of_SetPictureColumn(2, "4")
this.inv_levelsource.of_SetSelectedPictureColumn &
(2, "5")
4 Extend the pfc_Retrieve function, adding logic that handles retrieval arguments and calls the u_tvs of_Retrieve function:
Any la_args[20]
Integer li_level
TreeViewItem ltvi_item
IF IsValid(this.inv_levelsource) THEN
li_level = of_GetNextLevel(al_parent)
this.inv_levelsource.of_GetArgs(al_parent, &
li_level, la_args)
END IF
Return this.of_Retrieve &
(al_parent, la_args, ads_data)
5 Populate the TreeView by calling the u_tvs pfc_Populate event:
this.event pfc_Populate(0)
Library
PFCAPSRV.PBL
PFEAPSRV.PBL
Object relationships
n_cst_dwcache
n_cst_tvsrvattrib
n_ds
n_tr
Usage
To use this object:
1 Enable the service using the u_tvs of_SetLevelSource function:
this.of_SetLevelSource(TRUE)
2 Define a data source for each TreeView level by calling the of_Register function, once for each level:
this.inv_levelsource.of_Register(1, &
"dept_name", "", "d_deptlist", SQLCA, "")
this.inv_levelsource.of_Register(2, "emp_lname", &
":parent.1.dept_id", "d_empbydept", SQLCA, "")
3 Call additional functions as needed to control TreeView behavior:
this.inv_levelsource.of_SetPictureColumn(1, "1")
this.inv_levelsource.of_SetSelectedPictureColumn &
(1, "2")this.inv_levelsource.of_SetPictureColumn(2, "4")
this.inv_levelsource.of_SetSelectedPictureColumn &
(2, "5")
4 Extend the pfc_Retrieve function, adding logic that handles retrieval arguments and calls the u_tvs of_Retrieve function:
Any la_args[20]
Integer li_level
TreeViewItem ltvi_item
IF IsValid(this.inv_levelsource) THEN
li_level = of_GetNextLevel(al_parent)
this.inv_levelsource.of_GetArgs(al_parent, &
li_level, la_args)
END IF
Return this.of_Retrieve &
(al_parent, la_args, ads_data)
5 Populate the TreeView by calling the u_tvs pfc_Populate event:
this.event pfc_Populate(0)
#7
#8
学习 了2009年10月17日16时37分45秒
#9
// 第三层
li_rc = this.inv_levelsource.of_Register(&
3, "category", ":parent.1.categorycode", "d_category_2", SQLCA ,"")
不知道第三个参数":parent.1.categorycode"是什么意思?
li_rc = this.inv_levelsource.of_Register(&
3, "category", ":parent.1.categorycode", "d_category_2", SQLCA ,"")
不知道第三个参数":parent.1.categorycode"是什么意思?
#10
树必须是上下关联的,
它的意思是其父节点是取上一层(parent)的categorycode字段的值
#1
从不用PFC.帮顶.
#2
难道没有人用pfc了吗,这么多天没有人回了
#3
举个例子:constructure事件
// 清除原有的树形列表
of_setlevelsource(false)
do while finditem(RootTreeItem!,0) <> -1
of_reset()
loop
// 生成新的树形列表
of_setbase(true)
of_setlevelsource(true)
ib_rmbmenu = false
integer li_rc
long ll_firstitemonlevel,ll_count
string ls_msg
// 第一层
li_rc = this.inv_levelsource.of_Register(&
1, "category",'', sqlca, 'select ~'所有分类~' as category ' ,"")
if li_rc <> 1 then
ls_msg = '第一层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(1, "1")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(1, "1")
// 第二层
li_rc = this.inv_levelsource.of_Register(&
2, "category",'', "d_category_1", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第二层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(2, "2")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(2, "2")
//
// 第三层
li_rc = this.inv_levelsource.of_Register(&
3, "category", ":parent.1.categorycode", "d_category_2", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第三层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(3, "3")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(3, "3")
// 第四层
li_rc = this.inv_levelsource.of_Register(&
4, "category", ":parent.1.categorycode", "d_category_3", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第三层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(4, "4")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(4, "4")
// 第五层
li_rc = this.inv_levelsource.of_Register(&
5, "category", ":parent.1.categorycode", "d_category_4", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第四层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(5, "5")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(5, "5")
li_rc = this.event pfc_populate(0)
ll_firstitemonlevel = this.inv_base.of_FindFirstItemLevel(1, 0)
this.ExpandItem(ll_FirstItemOnLevel)
this.SelectItem(ll_firstitemonlevel)
return
err_exit:
messagebox('错误',ls_msg,StopSign!)
// 清除原有的树形列表
of_setlevelsource(false)
do while finditem(RootTreeItem!,0) <> -1
of_reset()
loop
// 生成新的树形列表
of_setbase(true)
of_setlevelsource(true)
ib_rmbmenu = false
integer li_rc
long ll_firstitemonlevel,ll_count
string ls_msg
// 第一层
li_rc = this.inv_levelsource.of_Register(&
1, "category",'', sqlca, 'select ~'所有分类~' as category ' ,"")
if li_rc <> 1 then
ls_msg = '第一层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(1, "1")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(1, "1")
// 第二层
li_rc = this.inv_levelsource.of_Register(&
2, "category",'', "d_category_1", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第二层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(2, "2")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(2, "2")
//
// 第三层
li_rc = this.inv_levelsource.of_Register(&
3, "category", ":parent.1.categorycode", "d_category_2", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第三层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(3, "3")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(3, "3")
// 第四层
li_rc = this.inv_levelsource.of_Register(&
4, "category", ":parent.1.categorycode", "d_category_3", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第三层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(4, "4")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(4, "4")
// 第五层
li_rc = this.inv_levelsource.of_Register(&
5, "category", ":parent.1.categorycode", "d_category_4", SQLCA ,"")
if li_rc <> 1 then
ls_msg = '第四层设置错误!'
goto err_exit
end if
li_rc = this.inv_levelsource.of_SetPictureColumn(5, "5")
li_rc = this.inv_levelsource.of_SetSelectedPictureColumn(5, "5")
li_rc = this.event pfc_populate(0)
ll_firstitemonlevel = this.inv_base.of_FindFirstItemLevel(1, 0)
this.ExpandItem(ll_FirstItemOnLevel)
this.SelectItem(ll_firstitemonlevel)
return
err_exit:
messagebox('错误',ls_msg,StopSign!)
#4
学习2009年10月14日21时55分30秒
#5
pfc本身带有例程,你没有吗?
#6
pfc帮助文件中也写的很详细
Library
PFCAPSRV.PBL
PFEAPSRV.PBL
Object relationships
n_cst_dwcache
n_cst_tvsrvattrib
n_ds
n_tr
Usage
To use this object:
1 Enable the service using the u_tvs of_SetLevelSource function:
this.of_SetLevelSource(TRUE)
2 Define a data source for each TreeView level by calling the of_Register function, once for each level:
this.inv_levelsource.of_Register(1, &
"dept_name", "", "d_deptlist", SQLCA, "")
this.inv_levelsource.of_Register(2, "emp_lname", &
":parent.1.dept_id", "d_empbydept", SQLCA, "")
3 Call additional functions as needed to control TreeView behavior:
this.inv_levelsource.of_SetPictureColumn(1, "1")
this.inv_levelsource.of_SetSelectedPictureColumn &
(1, "2")this.inv_levelsource.of_SetPictureColumn(2, "4")
this.inv_levelsource.of_SetSelectedPictureColumn &
(2, "5")
4 Extend the pfc_Retrieve function, adding logic that handles retrieval arguments and calls the u_tvs of_Retrieve function:
Any la_args[20]
Integer li_level
TreeViewItem ltvi_item
IF IsValid(this.inv_levelsource) THEN
li_level = of_GetNextLevel(al_parent)
this.inv_levelsource.of_GetArgs(al_parent, &
li_level, la_args)
END IF
Return this.of_Retrieve &
(al_parent, la_args, ads_data)
5 Populate the TreeView by calling the u_tvs pfc_Populate event:
this.event pfc_Populate(0)
Library
PFCAPSRV.PBL
PFEAPSRV.PBL
Object relationships
n_cst_dwcache
n_cst_tvsrvattrib
n_ds
n_tr
Usage
To use this object:
1 Enable the service using the u_tvs of_SetLevelSource function:
this.of_SetLevelSource(TRUE)
2 Define a data source for each TreeView level by calling the of_Register function, once for each level:
this.inv_levelsource.of_Register(1, &
"dept_name", "", "d_deptlist", SQLCA, "")
this.inv_levelsource.of_Register(2, "emp_lname", &
":parent.1.dept_id", "d_empbydept", SQLCA, "")
3 Call additional functions as needed to control TreeView behavior:
this.inv_levelsource.of_SetPictureColumn(1, "1")
this.inv_levelsource.of_SetSelectedPictureColumn &
(1, "2")this.inv_levelsource.of_SetPictureColumn(2, "4")
this.inv_levelsource.of_SetSelectedPictureColumn &
(2, "5")
4 Extend the pfc_Retrieve function, adding logic that handles retrieval arguments and calls the u_tvs of_Retrieve function:
Any la_args[20]
Integer li_level
TreeViewItem ltvi_item
IF IsValid(this.inv_levelsource) THEN
li_level = of_GetNextLevel(al_parent)
this.inv_levelsource.of_GetArgs(al_parent, &
li_level, la_args)
END IF
Return this.of_Retrieve &
(al_parent, la_args, ads_data)
5 Populate the TreeView by calling the u_tvs pfc_Populate event:
this.event pfc_Populate(0)
#7
#8
学习 了2009年10月17日16时37分45秒
#9
// 第三层
li_rc = this.inv_levelsource.of_Register(&
3, "category", ":parent.1.categorycode", "d_category_2", SQLCA ,"")
不知道第三个参数":parent.1.categorycode"是什么意思?
li_rc = this.inv_levelsource.of_Register(&
3, "category", ":parent.1.categorycode", "d_category_2", SQLCA ,"")
不知道第三个参数":parent.1.categorycode"是什么意思?
#10
树必须是上下关联的,
它的意思是其父节点是取上一层(parent)的categorycode字段的值