Oracle Forms Trigger: WHEN-TAB-PAGE-CHANGED

Published by Utkarsh Patel on 24/03/09 16:20:23
Last edited on 07/05/09 00:13:22

Chances are when you create a canvas with tabs, in Oracle Forms, you may want to perform a specific task on each tab and this is where the form level trigger WHEN-TAB-PAGE-CHANGED comes handy. Using the WHEN-TAB-PAGE-CHANGED Trigger will allow you to perform certain tasks that are unique to each tab, whenever that tab is selected. In the example below I am setting the cursor/active data block to the one that is associated with each particular tab in my canvas. You may want to do a host of other things such as perhaps changing the title of the TAB once it has been visited or changing the colour of the tab when it is selected. All of these tasks can be performed by using the built-in GET_TAB_PAGE_PROPERTY & SET_TAB_PAGE_PROPERTY functions.

Associated Functions

  • GET_CANVAS_PROPERTY - Use this built-in function to determine which tab is currently open
  • GET_TAB_PAGE_PROPERTY - Use this built-in function to get the tab properties
  • SET_TAB_PAGE_PROPERTY - Use this built-in function to set the tab properties

Usage Notes

  • Use a When-Tab-Page-Changed trigger to perform actions when any tab page is changed during item or mouse navigation.
  • When-Tab-Page-Changed will fire when the mouse or keyboard (explicit action) is used to navigate between tab pages, but the trigger will not fire if the user presses the [Next Item] button to navigate from one field to another field in the same data-block, but on different tabs
  • When-Tab-Page-Changed does not fire when the tab page is changed programmatically.

Sample Code
An annoyance of Oracle Forms Tabs are that when a tab is selected the focus still remains on the previous tab. Thus the user needs to click on an item in the tab before they can perform any actions. The example below shows you how to change focus to the tab by placing the cursor, using GO_ITEM, on one of the items present on the tab.

DECLARE
    tp_name varchar2(30);
BEGIN
-- Retrieve the NAME of the top most tab page using the built-in GET_CANVAS_PROPERTY function. Pass in the name of the Canvas your tabs are in and the system variable topmost_tab_page which stores a property number
tp_name := GET_CANVAS_PROPERTY('CANVAS11',topmost_tab_page);

-- Perform specific tasks based on the name of the top most tab
IF tp_name = 'PAGE12' then
   GO_ITEM('DATA_BLOCK_1.FIELD_1');
ELSIF tp_name = 'PAGE38' then
   GO_ITEM('DATA_BLOCK_2.FIELD_1');
ELSIF tp_name = 'PAGE47' then
   GO_ITEM('DATA_BLOCK_3.FIELD_1');
END IF;

END;

 

About the Author

Utkarsh Patel is one of our newest members, and he could not have come at a better time. He has helped bring back stability and control to Techlicity Ventures during our rapid growth. If he isn't marvelling at a recently discovered Oracle feature or technique he is bothering the rest of the team on why we should move everything over to Oracle databases. Utkarsh complements the team well with his determination and sound research.

Bookmark and Share
Blog Widget by LinkWithin
blog comments powered by Disqus

Valid XHTML 1.0!