一、建noTab的Folder Form:
1.创建数据库对象:
create table 和相应的view。
2.基于模板Template.fmb创建一个新的Form:****.fmb
添加一个Library:APPFLDR.pll(目录:$AU_TOP/Resource;打开后,系统询问是否去掉绝对路径,选择YES)
再打开APPSTAND.fmb:将其中的对象组STANDARD_FOLDER拖到自己的FORM中,选择Subclass
3.添加窗口 window:
设置属性:Subclass information:WINDOW
4.添加画布:MAIN(内容画布) 和 CANVAS(堆叠画布)
MAIN的type为content ;
CANVAS的type为stacked
subclass:canvas_Stacked
5.添加数据块:block(基于数据库)、 block_prompt(放Title)
设置对应属性:subclass都为BLOCK
画布block :Number of Records Displayed--8
ShowScrolbar--YES
Scrollbar Canvas-- MAIN 设置滚动条显示的画布
========== 以下对数据块block:======
6.添加触发器:
对数据块block:添加支持FOLDER的Block级的Trigger:
PRE-QUERY -- app_folder.event('PRE-QUERY');
POST-QUERY -- app_folder.event('POST-QUERY');
app_globe.event('POST-QUERY');
WHEN-NEW-BLOCK-INSTANCE app_folder.event('WHEN-NEW-BLOCK-INSTANCE');
WHEN-NEW-RECORD-INSTANCE app_folder.event('WHEN-NEW-RECORD-INSTANCE');
app_folder.event('KEY-PREV-ITEM');
app_folder.event('KEY-NEXT-ITEM');
app_folder.event('KEY-PRVREC');
app_folder.event('KEY-NXTREC');
app_folder.event('KEY-CLRREC');
app_folder.event('KEY-EXEQRY');
app_folder.event('KEY-ENTQRY');
app_folder.event('PRE-BLOCK');
app_folder.event('POST-BLOCK');
app_folder.event('KEY-CLRBLK');
pre-insert fnd_standard.set_who;
7.添加ITEM: Folder_Switcher and CURRENT_RECORD_indicator
注:这两个item要放置在块的最上面。
设置属性:SWITCHER:
item type:TEXT ITEM
SUBCLASS : SWITCHER
VISIBLE : yes
canvas :显示在堆叠画布CANVAS
PROMPT : 空
------------------------------
indicator:
ITEM TYPE: TEXT ITEM
SUBCLASS : CURRENT_RECORD_INDICATOR
VISIBLE : YES
CANVAS : 显示在内容画布MAIN
PROMPT : 空
========== 以下对数据块block_prompt:======
8.添加6个FOLDER特有的Item
注:放在block中的下方,顺序为:by321 dummy title open
itemtype subclass visible canvas
FOLDER_OPEN : push folder_open yes MAIN
FOLDER_TITLE: Display dynamic_title yes MAIN
FOLDER_DUMMY: TEXT FOLDER_DUMMY YES TOOLBAR
ORDER_BY1: PUSH FOLDER_ORDERBY NO CANVAS
ORDER_BY2: push FOLDER_ORDERBY no canvas
ORDER_BY3: push FOLDER_ORDERBY NO CANVAS
9.添加与基于数据库的block中的要显示的item对应的用于显示title的item
注:必须与之同名,宽度必须一致,且在block中的上下顺序一致。
设置属性:ITEMtype : Display Item
subclass : FOLDER_PROMPT_MULTIROW
InitialValue:需要显示的名称
10.更改App_custom Package 中的一些代码:
将wnd='****' ---改为自己的窗口名:WINDOW
11.更改Form级Trigger
pre-form: app_window.set_window_position('WINDOW','FISRT_WINDOW');--是显示的第一个窗口
12.设置窗口的primary Canvas 为 主画布MAIN
13.添加PACKAGE: Form_pkg
===============================================================
PACKAGE BODY Form_pkg IS
procedure new_form_instance is
begin
--定义Folder
app_folder.define_folder_block('Cup_ORDER_4040_2',--客户化自定义名
'block',--folder_block_name
'block_prompt',--prompt_block_name
'canvas',--folder_canvas_name
'window',--folder_window_name
null,--disabled_functions
null,--tab_canvas_name
null);--fixed_canvas_name
app_folder.event('INSTANTIATE');
SYNCHRONIZE;
end;
END;
================================
14.更改Form级trigger
when-new-form-instance :
FDRCSID('$Header: TRNORD4040.fmb 120.0 2005/05/06 23:25 appldev ship $');
APP_STANDARD.EVENT('WHEN-NEW-FORM-INSTANCE');
form_pkg.new_form_instance;
folder_action:
app_folder.event(:global.folder_action);
when-window-resized:
if :system.event_window in ('ORDER_MAIN') then
app_folder.event('WHEN-WINDOW-RESIZED');
end if;
key-CLRFRM :
APP_STANDARD.EVENT('KEY-CLRFRM');
app_folder.event('KEY-CLRFRM');
更改Item级trigger
folder_switcher: when-new-item-instance : app_folder_move_cursor('1');
current_record_indicator: when-new-item-instance: app_folder_move_cursor('1');
二、建有Tab的Folder Form:
*与非tab不同之处:
1.固定列不再放在内容画布上,而是放在子类型为canvas_stacked_fix_field的堆叠画布上
2.API定义Folder时的参数不同,需指定:tab_canvas_name,fixed_canvas_name 两个参数
*建Tab的Folder Form:
1.创建数据库对象:
create table 和相应的view。
2.基于模板Template.fmb创建一个新的Form:****.fmb
添加一个Library:APPFLDR.pll(目录:$AU_TOP/Resource;打开后,系统询问是否去掉绝对路径,选择YES)
再打开APPSTAND.fmb:将其中的对象组STANDARD_FOLDER拖到自己的FORM中,选择Subclass
3.添加窗口 window:
设置属性:Subclass information:WINDOW
4.添加画布:MAIN(内容画布) 和 CANVAS(堆叠画布)
CANVAS的subclass:canvas_Stacked
添加Tab类型的画布MAIN_Tab
设置属性:CanvasType: Tab
subclass :TAB_CANVAS
VISIBLE : YES
WINDOW :window
对标签页设置label(显示标题) 、设置subclass为TAB_PAGE
5.添加数据库:block(基于数据库)、 block_prompt(放Title)
设置对应属性:subclass都为BLOCK
画布block :Number of Records Displayed--8
ShowScrolbar--YES
Scrollbar Canvas-- ***FIX 设置垂直滚动条显示的画布(为fix画布)
========== 以下对数据块block:======
6.添加触发器:
对数据块block:添加支持FOLDER的Block级的Trigger:
PRE-QUERY -- app_folder.event('PRE-QUERY');
POST-QUERY -- app_folder.event('POST-QUERY');
app_globe.event('POST-QUERY');
WHEN-NEW-BLOCK-INSTANCE app_folder.event('WHEN-NEW-BLOCK-INSTANCE');
WHEN-NEW-RECORD-INSTANCE app_folder.event('WHEN-NEW-RECORD-INSTANCE');
app_folder.event('KEY-PREV-ITEM');
app_folder.event('KEY-NEXT-ITEM');
app_folder.event('KEY-PRVREC');
app_folder.event('KEY-NXTREC');
app_folder.event('KEY-CLRREC');
app_folder.event('KEY-EXEQRY');
app_folder.event('KEY-ENTQRY');
app_folder.event('PRE-BLOCK');
app_folder.event('POST-BLOCK');
app_folder.event('KEY-CLRBLK');
fnd_standard.set_who;
7.添加ITEM: Folder_Switcher and CURRENT_RECORD_indicator
注:这两个item要放置在块的最上面。
设置属性:SWITCHER:
item type:TEXT ITEM
SUBCLASS : SWITCHER
VISIBLE : yes
canvas :显示在堆叠画布CANVAS
PROMPT : 空
------------------------------
indicator:
ITEM TYPE: TEXT ITEM
SUBCLASS : CURRENT_RECORD_INDICATOR
VISIBLE : YES
CANVAS : 显示在内容画布MAIN
PROMPT : 空
========== 以下对数据块block_prompt:======
8.添加6个FOLDER特有的Item
注:放在block中的下方,顺序为:by321 dummy title open
itemtype subclass visible canvas
FOLDER_OPEN : push folder_open yes MAIN---改为fix
FOLDER_TITLE: Display dynamic_title yes MAIN---改为fix
FOLDER_DUMMY: TEXT FOLDER_DUMMY YES TOOLBAR
ORDER_BY1: PUSH FOLDER_ORDERBY NO CANVAS--更改为fix
ORDER_BY2: push FOLDER_ORDERBY no canvas
ORDER_BY3: push FOLDER_ORDERBY NO CANVAS
9.添加与基于数据库的block中的要显示的item对应的用于显示title的item
注:必须与之同名,宽度必须一致,且在block中的上下顺序一致。
设置属性:ITEMtype : Display Item
subclass : FOLDER_PROMPT_MULTIROW
InitialValue:需要显示的名称
10.更改App_custom Package 中的一些代码:
将wnd='****' ---改为自己的窗口名:WINDOW
11.更改Form级Trigger
pre-form: app_window.set_window_position('WINDOW','FISRT_WINDOW');--是显示的第一个窗口
12.设置窗口的primary Canvas 为 主画布MAIN
13.添加PACKAGE: Form_pkg
===============================================================
PACKAGE BODY Form_pkg IS
---------------------------
procedure new_form_instance is
begin
--定义TabFolder
app_folder.define_folder_block('Cup_ORDER_4040_2',
'ORDER_LINES',--folder_block_name
'ORDER_LINES_PROMPT',--prompt_block_name
'ORDER_CREATE_PROMPT,ORDER_CREATE_PROMPT_ADDITION',--folder_canvas_name
'ORDER_TAB',--folder_window_name
null,--disabled_functions
'MAIN_TAB',--tab_canvas_name
'FIX');--fixed_canvas_name
app_folder.event('INSTANTIATE');
SYNCHRONIZE;
end;
----------------------------------
/*隐藏标签页*/
PROCEDURE hide_main_tab( p_tab_name varchar2) IS
BEGIN
IF p_tab_name = 'ORDER_CREATE_PROMPT' THEN
hide_view('ORDER_CREATE_PROMPT_ADDITION');
ELSIF p_tab_name = 'ORDER_CREATE_PROMPT_ADDITION' THEN
hide_view('ORDER_CREATE_PROMPT');
END IF;
END hide_main_tab;
----------------------------------
/*定位光标*/
PROCEDURE go_tab_first_item(p_tab_name varchar2) IS
BEGIN
IF p_tab_name = 'ORDER_CREATE_PROMPT' THEN
go_item('ORDER_LINES.ITEM_NUMBER');
ELSIF p_tab_name = 'ORDER_CREATE_PROMPT_ADDITION' then
go_item('ORDER_LINES.ADDITION1');
END IF;
END go_tab_first_item;
----------------------------------
/*显示标签页*/
PROCEDURE show_main_tab( p_tab_name varchar2) is
begin
IF p_tab_name = 'ORDER_CREATE_PROMPT' THEN
show_view('ORDER_CREATE_PROMPT');
show_view('FIX');
ELSIF p_tab_name = 'ORDER_CREATE_PROMPT_ADDITION' THEN
show_view('ORDER_CREATE_PROMPT_ADDITION');
show_view('FIX');
end if;
END show_main_tab;
----------------------------------
/*当切换tab页*/
PROCEDURE when_tab_page_changed is
new_tab varchar2(30) := :system.tab_new_page;
prev_tab varchar2(30) := :system.tab_previous_page;
begin
hide_main_tab(prev_tab);
show_main_tab(new_tab);
go_tab_first_item(new_tab);
end when_tab_page_changed;
----------------------------------
/*当隐藏item,不能隐藏第一个item*/
PROCEDURE folder_return_action is
BEGIN
IF(:global.folder_action = 'CONFIRM-HIDE-FIELD') THEN
IF :global.folder_field = 'ADDITION1' THEN
:global.folder_action_allowed := 'FALSE';
elsif :global.folder_field='ITEM_NUMBER' then
:global.folder_action_allowed := 'FALSE';
END IF;
ELSIF (:global.folder_action = 'SET-WHERE-CLAUSE') THEN
--:global.folder_action_allowed := 'FALSE';
null;
END IF;
END folder_return_action;
----------------------------------
/*When_New_Item_Instance */
PROCEDURE When_New_Item_Instance IS
curr_canvas_name Varchar2(30) := get_item_property(Name_In('SYSTEM.CURSOR_ITEM'),item_canvas);
current_tab varchar2(30) := get_canvas_property('MAIN_TAB',topmost_tab_page);
tab_canvas_name Varchar2(30) := Name_In('SYSTEM.EVENT_CANVAS');
Begin
IF curr_canvas_name in ('ORDER_CREATE_PROMPT','ORDER_CREATE_PROMPT_ADDITION') THEN
IF curr_canvas_name != current_tab THEN
set_canvas_property('MAIN_TAB', topmost_tab_page, curr_canvas_name);
END IF;
END IF;
END When_New_Item_Instance;
----------------------------------
END;
================================
14.更改Form级trigger
when-new-form-instance :
FDRCSID('$Header: TRNORD4040.fmb 120.0 2005/05/06 23:25 appldev ship $');
APP_STANDARD.EVENT('WHEN-NEW-FORM-INSTANCE');
form_pkg.new_form_instance;
folder_action:
app_folder.event(:global.folder_action);
when-window-resized:
if :system.event_window in ('ORDER_MAIN') then
app_folder.event('WHEN-WINDOW-RESIZED');
end if;
key-CLRFRM :
APP_STANDARD.EVENT('KEY-CLRFRM');
app_folder.event('KEY-CLRFRM');
Folder_return_action: form_pkg.folder_return_action;
添加:when-tab-page-changed: form_pkg.when_tab_page_changed;
更改Item级trigger
folder_switcher: when-new-item-instance : app_folder_move_cursor('1');
current_record_indicator: when-new-item-instance: app_folder_move_cursor('1');
更改block级trigger:--解决TAB键在各个item之间导航时,tab页不变的问题
when-new-item-instance:form_pkg.when_new_item_instance;