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
Usage Notes
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;