TOPGP5.3:combobox动态下拉
2017-09-04 21:20
549 查看
一、前言
开发和维护TOPGP多年,一直觉得这个系统中的下拉框直接固定写死在4fd画面档中,是个非常恶心的设计,这个过程中也一直有浮现过想要自己写一个动态下拉框动态配置档的想法,但是一直拖着,终于在前段时间写了。以下就按部就班,将开发过程写出来,其实非常简单的一个东西,早在几年前就应该做了。
二、建立数据表
/* ================================================================================ 檔案代號:tc_dic_file 檔案名稱:下拉列表数据字典 檔案目的: 上游檔案: 下游檔案: 檔案類型:B 多語系檔案:N ============.========================.========================================== */ create table tc_dic_file ( tc_dic001 varchar2(10) NOT NULL, /*所属程序代号 */ tc_dic002 varchar2(10) NOT NULL, /*字段代号 */ tc_dic003 number(5) NOT NULL, /*序号 */ tc_dic004 varchar2(10), /*Value */ tc_dic005 varchar2(255), /*Item */ tc_dicacti varchar2(1) /*资料有效码 */ ); alter table tc_dic_file add constraint tpc_dic_pk primary key (tc_dic001,tc_dic002,tc_dic003) enable validate; grant select on tc_dic_file to tiptopgp; grant update on tc_dic_file to tiptopgp; grant delete on tc_dic_file to tiptopgp; grant insert on tc_dic_file to tiptopgp; grant index on tc_dic_file to public; grant select on tc_dic_file to ods;
三、建立画面档4fd
注:整合在文章尾部资源下载链接中四、建立程序代码4gl
注:整合在文章尾部资源下载链接中五、共用初始化函数4gl
1、代码片段
# Prog. Version..: '5.30.15-14.10.14(00000)' # # # Program name...: cl_set_combo_items_gae.4gl # Descriptions...: 動態設定ComboBox的Item. # Date & Author..: 17/07/24 by zhengzr DATABASE ds GLOBALS "../../config/top.global" FUNCTION cl_set_combo_items_plus(ps_field_name,p_tc_dic001,p_tc_dic002) DEFINE ps_field_name STRING DEFINE p_tc_dic001 LIKE tc_dic_file.tc_dic001 DEFINE p_tc_dic002 LIKE tc_dic_file.tc_dic002 DEFINE l_sql STRING DEFINE ps_values LIKE ze_file.ze03 DEFINE ps_items LIKE ze_file.ze03 WHENEVER ERROR CALL cl_err_msg_log LET l_sql = "SELECT to_char(wm_concat(tc_dic004)),to_char(wm_concat(tc_dic004||':'||tc_dic005)) ", " FROM tc_dic_file ", " WHERE tc_dic001='",p_tc_dic001,"' ", " AND tc_dic002 = '",p_tc_dic002,"' ", " ORDER BY tc_dic003 " PREPARE pre_001 FROM l_sql EXECUTE pre_001 INTO ps_values,ps_items CALL cl_set_combo_items(ps_field_name, ps_values, ps_items) END FUNCTION
2、函数说明
cl_set_combo_items_plus(ps_field_name,p_tc_dic001,p_tc_dic002)参数说明:
ps_field_name:当前画面上需要设置动态下拉的“字段代号”
p_tc_dic001:cooi800中设置的“所属程序代号”
p_tc_dic002:cooi800中设置的“字段代号”
六、使用演示
1、设置动态下拉项目
2、在4GL代码中增加初始化代码
3、效果展示
七、下载链接
1、动态下拉框数据表建立schema2、动态下拉框配置档4gl逻辑代码
3、动态下拉框配置档4fd画面代码
4、动态下拉框公用初始化函数4gl代码
相关文章推荐
- Ext.form.ComboBox 动态加载数据后设置下拉选项
- c#动态设置combobox控件下拉项宽度以实现下拉项文字可以完全显示。
- extjs 下拉列表ComboBox动态向后天获取数据
- c# winform comboBox动态下拉列表,comboBox动态绑定数据库里的数据
- 为DataGridview的Combobox列动态生成下拉列表
- DataGridView动态添加下拉列表DataGridViewComboBoxColumn并为下拉列表设置默认值
- Easyui Datagrid 的Combobox 如何动态修改下拉选项,以及值的转换
- jQuery-easyui中的combobox如何动态获取下拉框内容
- # winform comboBox动态下拉列表,comboBox动态绑定数据库里的数据
- 动态创建下拉列表框ComboBox
- 转:c# winform comboBox动态下拉列表,comboBox动态绑定数据库里的数据
- C#下动态更新combobox的下拉表单
- 【delphi】 TComboBox 动态生成下拉,并展开后鼠标丢失问题
- 多个下拉列表(select)不能取重复值判断-动态增加输入框-模仿CSDN结贴时分数判断-但无层提示-Ajax取值(全部源码)
- DevExpress控件(二)动态创建ASPxComboBox
- UGUI制作动态的下拉列表
- Extjs 动态加载ComboBox数据
- extjs中grid中嵌入动态combobox的应用
- springMVC+easyUI实现combobox动态级联查询
- jqueryeasyui-combobox下拉ajax实现