diff --git a/Chapters/ch03-a-top-toolbar.xml b/Chapters/ch03-a-top-toolbar.xml index 3f7fcf8..cac6fc3 100644 --- a/Chapters/ch03-a-top-toolbar.xml +++ b/Chapters/ch03-a-top-toolbar.xml @@ -52,7 +52,7 @@
Adding a toolbar -

Just as with the toolbox in the previous chapter, the first thing that we will need to do in order to create a toolbar is to design a suitable window template. This time, we will create a toolbar containing a couple of action buttons and a writable icon, which will span the top of our main window – a bit like the URL bar in a browser. The template has been called “Toolbar”, and can be seen in being edited in WinEd.

+

Just as with the toolbox in the previous chapter, the first thing that we will need to do in order to create a toolbar is to design a suitable window template. This time, we will create a toolbar containing a couple of action buttons and a writeable icon, which will span the top of our main window – a bit like the URL bar in a browser. The template has been called “Toolbar”, and can be seen in being edited in WinEd.

@@ -62,11 +62,11 @@ -

The height of the work area (y1y0) is set to be 60 OS Units: this allows a standard writable icon with a height of 52 OS Units, plus a 4 OS Unit space around it.

+

The height of the work area (y1y0) is set to be 60 OS Units: this allows a standard writeable icon with a height of 52 OS Units, plus a 4 OS Unit space around it.

We have also adjusted the minimum sizes of the bar, although this is as much to keep WinEd happy: with the minimum y dimenstion set to zero, the Wimp will limit the size to that required for the vertical scroll bar which WinEd applies in editing mode.

-

The window contains two action buttons and a writable icon, so that we can easily see how the work area moves around in relation to its parent window. All three icons are 52 OS Units high, to match the standard height for a writable icon, and there is a 4 OS Unit gap around the edges of the work area on all four sides.

+

The window contains two action buttons and a writeable icon, so that we can easily see how the work area moves around in relation to its parent window. All three icons are 52 OS Units high, to match the standard height for a writeable icon, and there is a 4 OS Unit gap around the edges of the work area on all four sides.

Once again, we can add the lines shown in to PROCinitialise in order to load the new template and create a window from it.

@@ -225,7 +225,7 @@ main%!28 = ToolBarWindow% SYS "Wimp_OpenWindow",,main% ENDPROC -

Running the upplication application should reveal a new toolbar attached to the top of the main window, as shown in . If moved around the screen or resized, both the toolbar and the original toolbox should move and adjust their sizes together. Note that if the caret is placed in the toolbar’s writable icon, the main window is shown as having input focus: this is a result of the panes having their ‘window is a pane’ flags set.

+

Running the upplication application should reveal a new toolbar attached to the top of the main window, as shown in . If moved around the screen or resized, both the toolbar and the original toolbox should move and adjust their sizes together. Note that if the caret is placed in the toolbar’s writeable icon, the main window is shown as having input focus: this is a result of the panes having their ‘window is a pane’ flags set.

@@ -275,6 +275,18 @@ toolbox%!16 = main%!16 - bar_height% : REM Visible Area Maximum Y
+ + +
+Cropping the writeable field + +

There’s one final niggle to look at before we move on, which can be seen when the width of the main window is reduced. The writeable icon in the bar appears to be truncated, with the right-hand end disappearing off out of view as seen in . Again, this isn’t the end of the world – we could simply left-align the text and ignore it. In fact, if we wish to support RISC OS 3.1 or earlier, then that’s the only option unless we wish to investigate drawing our own icons.

+ + + +

However, if we’re happy to support machines from the RiscPC onwards – which isn’t an unreasonable idea – then we can adjust the size of the writeable icon as we re-open the panes.

+ +
diff --git a/Images/Chapter03/top-bar-icon-crop.png b/Images/Chapter03/top-bar-icon-crop.png new file mode 100644 index 0000000..3958b93 Binary files /dev/null and b/Images/Chapter03/top-bar-icon-crop.png differ