0% found this document useful (0 votes)
141 views

Using PL/SQL Code To Activate Navigation Buttons

The document discusses using PL/SQL code to activate navigation buttons on a wizard canvas in Oracle Forms. It provides code examples for the Cancel, Back, and Next buttons that use the Wizard library procedures to clear data, finish the wizard, navigate to different pages, and prevent invalid navigation. The code blocks check the current page number and use go_item to navigate between different form items that display each wizard page.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
141 views

Using PL/SQL Code To Activate Navigation Buttons

The document discusses using PL/SQL code to activate navigation buttons on a wizard canvas in Oracle Forms. It provides code examples for the Cancel, Back, and Next buttons that use the Wizard library procedures to clear data, finish the wizard, navigate to different pages, and prevent invalid navigation. The code blocks check the current page number and use go_item to navigate between different form items that display each wizard page.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Using PL/SQL Code to Activate Navigation Buttons

The next series of steps is to make the navigation buttons on the Wiz_bar canvas work. This requires a When-Button-Pressed trigger for each button. The buttons will use the Wizard library procedures to perform the needed functionality. Exhibit 2.7 illustrates the PL/SQL for the Cancel button. This code block first clears the wizard of any data, without committing it. The Wizard_finish package procedure hides (i.e., closes) the Wizard window. However, the developer must navigate to an appropriate item or the current page will redisplay. The Exit_form subprogram performs this function. If you want to return to a different canvas within the form, use the Go_item or Go_block built-ins. Create a When-Button-Pressed trigger for the Cancel button using the code block in Exhibit 2.7. Exhibit 2.7: PL/SQL Code for the Cancel Button When-Button-Pressed Trigger
-- This removes the Wizard Window. clear_form (no_commit); Wizard.Wizard_Finish; exit_form; -- If you would like to display a base canvas rather than leaving -- the form, use a go_item or go_block subprogram rather than -- the exit_form End Listing

Exhibit 2.8 illustrates the PL/SQL code block used in the Back button's trigger. This trigger navigates to the previous wizard page. It uses the Wizard.Page_number package variable to compute the previous page number. It also has provisions to prevent the user from navigating to the Welcome page. The user will hear a bell alarm and will see a message if this navigation is attempted. You should notice that the actual navigation between pages is with the Go_item built-in. The Wizard procedures do not perform navigation. Navigation within the wizard is done in the tradition Forms manner. Create a When-Button-Pressed trigger for the Back button using the code block in Exhibit 2.8. Exhibit 2.8: PL/SQL Code for the Back Button When-Button-Pressed Trigger
declare -- Computes the number of the previous wizard page next_page number default Wizard.Page_Number-1; begin -- Navigate to the appropriate page if next_page = 1 then -- The following two lines prevent the user from navigating to the Welcome Page.bell; message (You are on the first Employee Entry page'); else if next_page = 2 then go_item(EMPLOYEE.PAYROLL_NUMBER'); elsif next_page = 3 then go_item(EMPLOYEE.SOCIAL_SECURITY_NUMBER'); elsif next_page = 4 then go_item(EMP_TOOLS.PURCHASE_DATE'); end if; -- Set the page number to previous page and display it Wizard.Wizard_Show(next_page); -- The name of the new canvas is in package variable -- Wizard.PageName

end if; end;

Exhibit 2.9: PL/SQL Code Block for the Next Button's When-ButtonPressed Trigger
declare next_page number default Wizard.Page_Number+1; begin --Navigate to the appropriate page if next_page = 2 then go_item(EMPLOYEE.PAYROLL_NUMBER'); -- Set the page number to previous page and display it Wizard.Wizard_Show(next_page); -- The name of the new canvas is in package variable -- Wizard.PageName elsif next_page = 3 then go_item(EMPLOYEE.SOCIAL_SECURITY_NUMBER'); Wizard.Wizard_Show(next_page); elsif next_page = 4 then go_item(EMP_TOOLS.PURCHASE_DATE'); Wizard.Wizard_Show(next_page); elsif next_page = 5 then go_item(employee.holder'); Wizard.Wizard_Show(next_page); else bell; message(You are on the last page of the Wizard'); end if; end;

You might also like