Title: How to add pages and GUI controls inside them to a tab control dynamically?

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:

    03 Tb1-container
       tab-control
       line                 5
       col                  2
       lines                17 cells
       size                 68 cells
       allow-container
       .
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
            upon Tb1-Container(t1-next-page)
    display entry-field line 10 col 4
            upon Tb1-Container(t1-next-page)

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:
    iscrun DYNTAB

Authored by: Veryant Support on Thu, Nov 28th, 2019 at 7:00 PM
This question has been viewed 2438 times so far.
Online URL: http://support.veryant.com/support/phpkb/question.php?ID=308

Powered by PHPKB Knowledge Base Software