Thursday 1 October 2009

How to display both Vertical and Horizontal Scroll Bars in Detail Block in Oracle Forms 6i?

Problem
A Detail Block in Oracle Forms 6i with many fields in tabular format needs not only a Vertical Scroll Bar, but also a Horizontal Scroll Bar so that we can see all the information we need for a Record.
But the problem is that a Data Block supports only one Scroll Bar at a time. We can choose to use or not a Scroll Bar, setting the Show Scroll Bar property to Yes or No at the Data Block level. If the Scroll Bar will be displayed, we can establish its orientation setting the Scroll Bar Orientation property to Horizontal or Vertical. So how to display both Vertical and Horizontal Scroll Bars in Detail Block in Oracle Forms 6i?

Solution

Create the Detail Data Block setting Show Scroll Bar property to Yes and Scroll Bar Orientation property to Vertical. Add some fields from the Detail Block on the Content Canvas.
Create a Stacked Canvas and put the other needed fields from the Detail Block on it. For the Stacked Canvas set Show Horizontal Scroll Bar property to Yes.

Solution description with an example
This example uses the HR schema. The Master Block contains the departments and the Detail Block contains all the employees from the department displayed in the Master Block. Suppose you already have created the Master Block based on departments table.

Step 1
Create the Detail Block based on employees table. Choose to display only a few items from this Data Block (for example, only first_name and last_name). Set the Number of Records Displayed property to 10 (or other value grater than 1). Set the Show Scroll Bar property to Yes and set the Scroll Bar Orientation property to Vertical. Then move the Scroll Bar object in the right side of the frame, like in the next image:

Step 2
Associated with the Content Canvas make a Stacked Canvas and place it on the Content Canvas in the space between Last Name Item Text and the Scroll Bar object (the green rectangle in the previous image). For Stacked Canvas set the Show Horizontal Scroll Bar to Yes.

Step 3
Place in the Stacked Canvas all the fields that you need from Detail Block, like in the next images:
Content Canvas

Stacked Canvas

The Text Items from the Detail Block placed in the Content Canvas will be synchronized with the Text Items placed in the Stacked Canvas.

4 comments: