Organizing with Tab Panels

 

Sample code:
Display file source:                 PUISAMPLES/QDDSSRC(TAB001D)
RPGLE source:                      PUISAMPLES/QRPGLESRC(TAB001R)

Use tab panels to organize application content into separate tabs.  Each tab will contain its own set of widgets.

To begin, drag and drop a tab panel widget onto the canvas, and use the plus and minus icons on the right to control the number of tabs the panel will contain.



Next, double-click each tab to specify the tab’s caption.



Now, drag and drop other widgets into the appropriate tabs.  When you drop an element, a message at the bottom of the tab panel will flash, indicating that the element has been added to the panel.



Note: In order to register as an element that belongs to the panel, the widget must be inside the panel in full when you drop it.

Once the tab panel is positioned, you may choose to right-click the panel and lock it in place.  This will allow you drag your mouse over multiple elements within the tab panel and select them without selecting the tab panel itself.

You can control the initial active tab at runtime by specifying the tab panel’s active tab property or binding a numeric RPG variable to the active tab property. Each tab within the tab panel is identified by a sequential index, starting with 0 for the first tab, 1 for the second tab, and so on.

When the user switches between tabs, no server-side RPG code will execute unless you also bind the tab response property to a numeric field.  By specifying the tab response, you can repopulate tab content dynamically.  It is recommended that the tab response and the active tab properties are bound to the same RPG field.  This maintains the active tab as the screen refreshes.

Â