Example
Create Block Named as BLK_BUTTONS
Create following Buttons in BLK_BUTTONS
PB_ENTER_QUERY
PB_EXECUTE_QUERY
PB_CANCEL_QUERY
PB_SAVE
PB_DELETE
PB_ADD
PB_CLEAR
PB_SCROLL_UP
PB_SCROLL_DOWN
PB_NEXT_RECORD
PB_PREVIOUS_RECORD
PB_PREVIOUS_SCREEN
PB_NEXT_SCREEN
PB_EXIT
Form-Level:
UserDefined-Trigger:
if :system.mode in ('ENTER-QUERY') then
disable all buttons except execute query, cancel query and exit form
else
enable all buttons except cancel query
if :system.trigger_record = '1' then
disable previous record, first record
enable next record, last record
if :system.last_record = 'TRUE' then
disable next record, last record
enable previous record, first record
WHEN-NEW-RECORD-INSTANCE
execute_trigger('UserDefined-Trigger');
-----------------------------------------------------------------------------------------
-- run toolref button commands
if upper(substr(:system.trigger_item,1,9)) = 'BLK_BUTTONS' then
if :system.trigger_item = 'BLK_BUTTONS.PB_ENTER_QUERY' then
do_key('enter_query');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_EXECUTE_QUERY' then
do_key('execute_query');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_CANCEL_QUERY' then
do_key('exit_form');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_SAVE' then
do_key('commit_form');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_DELETE' then
do_key('delete_record');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_ADD' then
do_key('create_record');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_CLEAR' then
do_key('clear_form');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_SCROLL_UP' then
do_key('scroll_up');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_SCROLL_DOWN' then
do_key('scroll_down');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_NEXT_RECORD' then
do_key('down');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_PREVIOUS_RECORD' then
do_key('up');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_PREVIOUS_SCREEN' then
do_key('previous_block');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_NEXT_SCREEN' then
do_key('next_block');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_EXIT' then
do_key('exit_form');
end if;
end if; -- BLK_BUTTONS commands
Create Block Named as BLK_BUTTONS
Create following Buttons in BLK_BUTTONS
PB_ENTER_QUERY
PB_EXECUTE_QUERY
PB_CANCEL_QUERY
PB_SAVE
PB_DELETE
PB_ADD
PB_CLEAR
PB_SCROLL_UP
PB_SCROLL_DOWN
PB_NEXT_RECORD
PB_PREVIOUS_RECORD
PB_PREVIOUS_SCREEN
PB_NEXT_SCREEN
PB_EXIT
Form-Level:
UserDefined-Trigger:
if :system.mode in ('ENTER-QUERY') then
disable all buttons except execute query, cancel query and exit form
else
enable all buttons except cancel query
if :system.trigger_record = '1' then
disable previous record, first record
enable next record, last record
if :system.last_record = 'TRUE' then
disable next record, last record
enable previous record, first record
WHEN-NEW-RECORD-INSTANCE
execute_trigger('UserDefined-Trigger');
-----------------------------------------------------------------------------------------
-- run toolref button commands
if upper(substr(:system.trigger_item,1,9)) = 'BLK_BUTTONS' then
if :system.trigger_item = 'BLK_BUTTONS.PB_ENTER_QUERY' then
do_key('enter_query');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_EXECUTE_QUERY' then
do_key('execute_query');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_CANCEL_QUERY' then
do_key('exit_form');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_SAVE' then
do_key('commit_form');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_DELETE' then
do_key('delete_record');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_ADD' then
do_key('create_record');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_CLEAR' then
do_key('clear_form');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_SCROLL_UP' then
do_key('scroll_up');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_SCROLL_DOWN' then
do_key('scroll_down');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_NEXT_RECORD' then
do_key('down');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_PREVIOUS_RECORD' then
do_key('up');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_PREVIOUS_SCREEN' then
do_key('previous_block');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_NEXT_SCREEN' then
do_key('next_block');
elsif :system.trigger_item = 'BLK_BUTTONS.PB_EXIT' then
do_key('exit_form');
end if;
end if; -- BLK_BUTTONS commands
No comments:
Post a Comment