Skip to content

Commit

Permalink
Make the template name buffer more logical.
Browse files Browse the repository at this point in the history
The Wimp requires a 12 byte, word-aligned buffer, enough to hold 11
characters and a CHR$(13) terminator.
  • Loading branch information
steve-fryatt committed Jul 27, 2022
1 parent 1cc8110 commit 6451ecd
Show file tree
Hide file tree
Showing 16 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Chapters/ch01-an-example-application.xml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ ENDPROC</code>

<code id="list-example-app-init-temp" lang="bbcbasic" title="Initialising the window templates">REM Load the window templates

DIM TemplateName% 12
DIM TemplateName% 11

SYS &quot;Wimp_OpenTemplate&quot;,,&quot;&lt;PaneDemo$Dir&gt;.Templates&quot;

Expand All @@ -211,12 +211,12 @@ SYS &quot;Wimp_CloseTemplate&quot;</code>

<p>The code opens the <file>Templates</file> file with <swi>Wimp_OpenTemplate</swi>, then loads the templates for the main window and program information window in turn. For each, a window is created immediately using <swi>Wimp_CreateWindow</swi>, with the handles being stored in the <variable>MainWindow%</variable> and <variable>InfoWindow%</variable> variables respectively. We also take the opportunity to calculate the width and height of the main window in OS&nbsp;Units, and store the values in the <variable>WindowWidth%</variable> and <variable>WindowHeight%</variable> variables for future reference.</p>

<p>The code uses <function>PROCtemplate_load()</function>, which puts a friendly wrapping around the <swi>Wimp_LoadTemplate</swi> SWI and expects there to be a global <variable>TemplateName%</variable> variable pointing to a 12 character plus terminator, word-aligned buffer for holding the template names. Its definition can be seen in <reference id="list-example-app-load-temp" />.</p>
<p>The code uses <function>PROCtemplate_load()</function>, which puts a friendly wrapping around the <swi>Wimp_LoadTemplate</swi> SWI and expects there to be a global <variable>TemplateName%</variable> variable pointing to a 12 character, word-aligned buffer for holding the template names. Its definition can be seen in <reference id="list-example-app-load-temp" />.</p>

<code id="list-example-app-load-temp" lang="bbcbasic" title="Load a window template into memory">DEF PROCtemplate_load(name$, buffer%, size%, fonts%)
LOCAL templ_size%, indir_size%, workspace%

$TemplateName% = LEFT$(name$ + STRING$(12, CHR$(13)), 12)
$TemplateName% = LEFT$(name$, 11)

REM Find the size required for the template and indirected data.

Expand Down
2 changes: 1 addition & 1 deletion Chapters/ch04-column-headings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

<code id="list-col-head-load" lang="bbcbasic" title="Loading the three window templates">REM Load the window templates

DIM TemplateName% 12
DIM TemplateName% 11

SYS &quot;Wimp_OpenTemplate&quot;,,&quot;&lt;PaneDemo$Dir&gt;.Templates&quot;

Expand Down
Binary file modified Downloads/Chapter01/ExampleApp/!PaneDemo/!RunImage,ffb
Binary file not shown.
Binary file modified Downloads/Chapter02/SideBox1/!PaneDemo/!RunImage,ffb
Binary file not shown.
Binary file modified Downloads/Chapter02/SideBox2/!PaneDemo/!RunImage,ffb
Binary file not shown.
Binary file modified Downloads/Chapter02/SideBox3/!PaneDemo/!RunImage,ffb
Binary file not shown.
Binary file modified Downloads/Chapter03/TopBar1/!PaneDemo/!RunImage,ffb
Binary file not shown.
Binary file modified Downloads/Chapter03/TopBar2/!PaneDemo/!RunImage,ffb
Binary file not shown.
Binary file modified Downloads/Chapter03/TopBar3/!PaneDemo/!RunImage,ffb
Binary file not shown.
Binary file modified Downloads/Chapter03/TopBar4/!PaneDemo/!RunImage,ffb
Binary file not shown.
Binary file modified Downloads/Chapter04/ColHead1/!PaneDemo/!RunImage,ffb
Binary file not shown.
Binary file modified Downloads/Chapter04/ColHead2/!PaneDemo/!RunImage,ffb
Binary file not shown.
Binary file modified Downloads/Chapter05/ColHead3/!PaneDemo/!RunImage,ffb
Binary file not shown.
Binary file modified Downloads/Chapter05/ColHead4/!PaneDemo/!RunImage,ffb
Binary file not shown.
Binary file modified Downloads/Chapter06/NestedFixed/!PaneDemo/!RunImage,ffb
Binary file not shown.
Binary file modified Downloads/Chapter06/NestedScroll/!PaneDemo/!RunImage,ffb
Binary file not shown.

0 comments on commit 6451ecd

Please sign in to comment.