diff --git a/Chapters/ch08-moving-the-furniture.xml b/Chapters/ch08-moving-the-furniture.xml index 4f96cd5..43ecf9a 100644 --- a/Chapters/ch08-moving-the-furniture.xml +++ b/Chapters/ch08-moving-the-furniture.xml @@ -55,7 +55,7 @@
NetSurf, on the other hand, uses the easy option and takes advantage of what the Nested Wimp calls
To show how this works, we will take the responsive toolbar that we created in the
With these changes in place, we can now close the templates and move on to updating the program itself.
+With these changes in place, we can now close the templates and move on to updating the program itself. We’ll need to update
PROCtemplate_load("Embedded", b%, buffer_size%, -1)
+SYS "Wimp_CreateWindow",,b% TO ToolBoxWindow%
+
+We can also simplify the
CASE reason% OF
+ WHEN 2 : SYS "Wimp_OpenWindow",,b%
+ WHEN 3 : SYS "Wimp_CloseWindow",,b%
+ WHEN 6 : PROCmouse_click(b%)
+ WHEN 9 : PROCmenu_selection(b%)
+ WHEN 17, 18 : IF b%!16 = 0 THEN Quit% = TRUE
+ENDCASE
The remaining changes that we need to make reside in
The process for laying the toolbox out is very similar to that used in the previous chapter, although we have changed the name of the
main% = q%
+toolbox% = q% + 100
+main_outline% = q% + 200
+
+We will also amend the call to
!toolbox% = ToolBoxWindow%
+SYS "Wimp_GetWindowInfo",,toolbox% OR %1
+
+The dimensions of the new toolbox will depend on the height (or thickness) of the horizontal scroll bar that we’re about to embed it in to. This depends on the window tool sprites in use on the system, but we can calculate it as the difference between the
box_height% = main%!8 - main_outline%!8
+
+However, there’s a problem. Both of the
SYS "OS_ReadModeVariable", -1, 5 TO ,,eigenfactor%
+
+Armed with this information, we can then calculate the height of the toolbox.
+ +box_height% = main%!8 - main_outline%!8 - 2 * (2 ^ eigenfactor%) : REM Visible Area Y0 - Outline Y0
+
+As we currently have nothing to go into the toolbox, the width is largely immaterial and so for now we will set it to 200 OS Units.
+ +box_width% = 200
+
+