Now it is possible to decide during runtime if some pages will be added or not to a tab control depending on the nature of the data or specific data values you have.
And furthermore, you may also dynamically populate such pages with any GUI controls you need.
In this sense, if for instance you declare a tab control on the screen section like this:
lines 17 cells
size 68 cells
The statement to add pages dynamically is like the following:
modify Tb1-container tab-to-add ("page1", "page2")
Now, in order to add dynamic controls to each new page, it is important to remember that every tab page is indexed by an incremental integer number.
So, in general, it is just a matter of displaying the new dynamic GUI control upon the wanted tab page using its index.
Therefore, if you want to add a label and an entry field to page 3 of the tab control, you would do it like this:
(the following code assumes the t1-next-page variable value is 3 and the label-title contains the title you want for the string)
display label line 8 col 4 title label-title
display entry-field line 10 col 4
You may download a complete sample program that demonstrates this functionality.
Compile it like this:
iscc -sp="%iscobol%sampleisdef" dyntab.cbl
Run it like this: