Tabs

From BR Wiki
(Redirected from Tab window)
Jump to navigation Jump to search

Requires Business Rules! 4.16+. BR can set up tabs or tabbed windows opened at the same row and column with the TAB= keyword. In order to respond to the user clicking a tab, the FKEY value 92 is generated when a tab is clicked. This lets the program change focus to the desired tab by performing an IO statement to it.

For example:

00100 open #14: "srow=5,scol=5,rows=5,cols=20,TAB=The Tab's Caption", Display, Outin

The system function CURTAB is also available.

The example below opens two windows. The two windows are in the same tabbed group since they are opened at the same row and column with the TAB= keyword. IO will start in window #1. At first, FKEY will be -1, since no buttons or tabs have been clicked yet and ENTER has not been pressed.

If the user clicks on the second tab, FKEY value 92 will be generated and printed. After this, any time the user clicks on either of the tabs, FKEY value 92 will be generated and printed. While in either of the two windows, the user may enter in up to 10 characters into the text box. Upon pressing ENTER, FKEY value 0 will be generated. Upon clicking the "continue" button, FKEY value 20 or 22 will be generated, depending on which window the user is currently in. The program will stop executing if the Esc key or either of the two "Cancel" buttons is pressed. Also, on lines 600 and 1200, CURTAB is printed to indicated which tab has been clicked on most recently.

The name of this program is: TABS.BR

00100 print NEWPAGE
00200 open #1: "srow=2,scol=2,rows=20,cols=60,TAB=tab1",display,outin
00300 open #2: "srow=2,scol=2,rows=20,cols=60,TAB=tab2",display,outin
00400 do
00500    if CURTAB(1)=1 then
00600       print #1, fields "3,1,N 2;3,4,N 2": FKEY,CURTAB(1)
00700       print #1, fields "2,1,CC 10,,B20;2,12,CC 6,,B21": "Continue","Cancel"
00800       input #1, fields "1,1,C 10": VAR1$
00900       print #1, fields "4,1,C 10": VAR1$
01000    end if
01100    if CURTAB(1)=2 then
01200       print #2, fields "3,1,N 2;3,4,N 2" : FKEY,CURTAB(1)
01300       print #2, fields "2,1,CC 10,,B22;2,12,CC 6,,B23": "Continue","Cancel"
01400       input #2, fields "1,1,C 10": VAR2$
01500       print #2, fields "4,1,C 10" : VAR2$
01600    end if
01700 loop UNTIL FKEY=99 OR FKEY=21 OR FKEY=23
Output

Before any buttons or tabs have been clicked yet and before ENTER has been pressed:

If the user clicks on the second tab:


If the user types data into the textbox and presses ENTER:


If the user enters data into the textbox and clicks "Continue":