How to improve the performance of your application by making your Tab-Control a container.
Estimated Reading Time: 1 MinutesWhen the allow-container style is set, a tab control becomes a container control.
03 screen1-tc-1 tab-control
tab-to-add ("Page1", "Page2")
allow-container.
By making the tab control a container, you remove the need to manage the tab switch by intercepting the CMD-TABCHANGED event and updating the screen with the DISPLAY verb. The tab switch is automatically managed by the runtime Framework. This simplifies your coding and also reduces traffic in thin client and WebClient environments, which improves performance.
There are two ways to add controls to a Tab-Control with the Allow-Container style:
- by using a Format 2 DISPLAY statement. E.g.
display scr-page-1 upon screen1-tc-1(1)
or
- by setting the attributes TAB-GROUP and TAB-GROUP-VALUE on the screen entry. E.g.
03 scr-page-1 tab-group screen1-tc-1, tab-group-value 1.
05 entry-field
...
03 scr-page-2 tab-group screen1-tc-1, tab-group-value 2.
05 list-box
...
Example – Here’s a tab-control with two pages with the allow-container style
SCREEN SECTION.
01 Mask.
03 Tb1-container
tab-control
line 2
col 2
lines 17 cells
size 68 cells
allow-container
.
03 tb1-container-page1
tab-group Tb1-container tab-group-value 1.
05 label
line 4
col 4
title "This is the first page"
.
05 ef1-container
entry-field
line 6
col 4
.
03 tb1-container-page2
tab-group Tb1-container tab-group-value 2.
05 label
line 4
col 4
title "This is the second page"
.
05 cb1-container
combo-box
line 6
col 4.
PROCEDURE DIVISION.
MAIN.
...
display Mask
modify Tb1-container tab-to-add ("Page1", "Page2")
modify Cb1-container item-to-add ("item1", "item2")
. . .
perform until crt-status = 27
accept Mask
on exception
continue
end-accept
if crt-status = 2
. . .
end-if
end-perform.