This code also disables the ability to resize or maximise the window.\\ \\

This code also disables the ability to resize or maximise the window.\\ \\

==== Handling page changes ====

==== Handling page changes ====

\\ This is where it gets interesting! Unlike a Property Sheet, changing what is displayed on each page as the tabs are clicked by the user is your responsibility. You must monitor the page changes, and automatically hide the contents of the previous page and show the contents of the new page as required. The basic code to monitor changes is as follows:\\ \\

\\ This is where it gets interesting! Unlike a Property Sheet, changing what is displayed on each page as the tabs are clicked by the user is your responsibility. You must monitor the page changes, and automatically hide the contents of the previous page and show the contents of the new page as required. The basic code to monitor changes is as follows:\\ \\

+

<code bb4w>

prevsel% = -1

prevsel% = -1

REPEAT

REPEAT

Line 60:

Line 71:

UNTIL INKEY(1) = 0

UNTIL INKEY(1) = 0

END

END

+

</​code>​

Here two variables **prevsel%** and **currsel%** keep track of the previous and current selections respectively.\\ \\ There are two main approaches to drawing on the pages. One is to draw individual controls (buttons, boxes etc.) and the other is to display a dialogue box on each page, where the dialogue boxes contain the controls. Using dialogue boxes has the advantage of providing the standard navigation controls (e.g. using Tab) but is complicated by the DPI issue (see later).\\ \\ To start off with here is a simple example of displaying an individual button on the second tab (currsel% = 1):\\ \\

Here two variables **prevsel%** and **currsel%** keep track of the previous and current selections respectively.\\ \\ There are two main approaches to drawing on the pages. One is to draw individual controls (buttons, boxes etc.) and the other is to display a dialogue box on each page, where the dialogue boxes contain the controls. Using dialogue boxes has the advantage of providing the standard navigation controls (e.g. using Tab) but is complicated by the DPI issue (see later).\\ \\ To start off with here is a simple example of displaying an individual button on the second tab (currsel% = 1):\\ \\

+

<code bb4w>

hbutton% = FN_button(hTC%,"​Tab Two",​50,​50,​100,​24,​100,​0)

hbutton% = FN_button(hTC%,"​Tab Two",​50,​50,​100,​24,​100,​0)

SYS "​ShowWindow",​ hbutton%, SW_HIDE

SYS "​ShowWindow",​ hbutton%, SW_HIDE

Line 74:

Line 87:

UNTIL INKEY(1) = 0

UNTIL INKEY(1) = 0

END

END

+

</​code>​

Here the button is hidden when the //​previous//​ selection is 1, and shown when the //current// selection is 1. Hopefully you can see how the code could be extended to cover multiple controls on multiple pages. See the description of the [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwing.html#​winlib5|WINLIB5A library]] for details of the various controls that can be incorporated.\\ \\ In the alternative case the code to display a dialogue box on each tab would be as follows:\\ \\

Here the button is hidden when the //​previous//​ selection is 1, and shown when the //current// selection is 1. Hopefully you can see how the code could be extended to cover multiple controls on multiple pages. See the description of the [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwing.html#​winlib5|WINLIB5A library]] for details of the various controls that can be incorporated.\\ \\ In the alternative case the code to display a dialogue box on each tab would be as follows:\\ \\

+

<code bb4w>

FOR index% = 0 TO DIM(dlg%(), 1)

FOR index% = 0 TO DIM(dlg%(), 1)

!(dlg%(index%)!4+8) = hTC%

!(dlg%(index%)!4+8) = hTC%

Line 91:

Line 106:

UNTIL INKEY(1) = 0

UNTIL INKEY(1) = 0

END

END

+

</​code>​

Here **dlg%()** is an array containing the values returned from [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwing.html#​newdialog|FN_newdialog()]]. Note the special piece of '​magic'​ code preceding the **PROC_showdialog()** which is essential to make this work.\\ \\ You should create your dialogue boxes in the usual way, one for each tab; that can be done at the start of the program during the initialisation phase. See the description of the [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwing.html#​winlib2|WINLIB2 library]] for details. Since the size of a dialogue box, in pixels, varies with the DPI (dots-per-inch) setting you may need to take special care to ensure the dialogue boxes fit the pages of the tab control (see [[/​Supporting%20different%20DPI%20values|Supporting different DPI values]]).\\ \\

Here **dlg%()** is an array containing the values returned from [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwing.html#​newdialog|FN_newdialog()]]. Note the special piece of '​magic'​ code preceding the **PROC_showdialog()** which is essential to make this work.\\ \\ You should create your dialogue boxes in the usual way, one for each tab; that can be done at the start of the program during the initialisation phase. See the description of the [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwing.html#​winlib2|WINLIB2 library]] for details. Since the size of a dialogue box, in pixels, varies with the DPI (dots-per-inch) setting you may need to take special care to ensure the dialogue boxes fit the pages of the tab control (see [[/​Supporting%20different%20DPI%20values|Supporting different DPI values]]).\\ \\