Back in the late 1980s, when RISC OS was a new system, space on the screens of the day was limited and there was a trend for using minimalist toolboxes embedded into the space used by the scrollbars of a window. Of the numerous applications which used the technique, the original Ovation is still well-known – its take on the idea can be seen in
At the time, Ovation’s author created this effect using three windows, which are all interleaved carefully. These days, the effect can be achieved more easily using the Nested Wimp, and in previous chapters we have already seen examples from Paint (
Working out the horizontal position of the new toolbox should be a familiar process. We will be anchoring it to the left hand side of the main window’s work area, as shown in
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.
@@ -113,9 +113,9 @@ SYS "Wimp_GetWindowInfo",,toolbox% OR %1toolbox%!4 = main%!4 : REM Visible Area X0
toolbox%!12 = main%!4 + box_width% : REM Visible Area X1
-Positioning the toolbar in the vertical dimension, however, is more tricky than anything which we have encountered up to now. As can be seen in
Positioning the toolbox in the vertical dimension, however, is more tricky than anything which we have encountered up to now. As can be seen in
The
SYS "OS_ReadModeVariable", -1, 5 TO ,,eigenfactor%
pixel_height% = 2 ^ eigenfactor%
-With the toolbar positioned, the final thing to do before opening it as a child window is to use
With the toolbox positioned, the final thing to do before opening it as a child window is to use
toolbox%!52 = toolbox%!44 + box_width%
toolbox%!48 = toolbox%!56 - box_height%
SYS "Wimp_SetExtent", ToolBoxWindow%, toolbox% + 44
-The toolbar is anchored a little differently to what we have seen before, as it is connected to the left and bottom of the main window’s work area. This results in us using flags of &05550000.
+The toolbox is anchored a little differently to what we have seen before, as it is connected to the left and bottom of the main window’s work area. This results in us using flags of &05550000.
toolbox%!28 = -1
@@ -144,7 +144,7 @@ SYS "Wimp_OpenWindow",,toolbox%, &4B534154, !main%, &05550000<
Bringing all of these changes together results in PROCopen_main_window looking as shown in .
-DEF PROCopen_main_window
+DEF PROCopen_main_window
LOCAL screen_width%, screen_height%, window_width%, window_height%, main%, main_outline%
LOCAL toolbox%, box_width%, box_height%, eigenfactor%, pixel_height%
@@ -234,22 +234,22 @@ toolbox%!28 = -1
SYS "Wimp_OpenWindow",,toolbox%, &4B534154, !main%, &05550000
ENDPROC
-Running the application will produce a window with a toolbar embedded into the horizontal scroll bar, as seen in .
+Running the application will produce a window with a toolbox embedded into the horizontal scroll bar, as seen in .
-
+
The application as it stands so far can be found in .
-
+
A toolbox isn’t much use without some icons in it, so the next thing that we will need to do is add some. Unlike all of our previous panes, however, the critical dimension – the height of the toolbar window, which will determine the size of the icons within it – is dependent on a factor outside of our control. It is defined by the height of the horizontal scroll bar, which in turn will depend on the desktop theme and mode that user has selected.
+A toolbox isn’t much use without some icons in it, so the next thing that we will need to do is add some. Unlike all of our previous panes, however, the critical dimension – the height of the toolbox window, which will determine the size of the icons within it – is dependent on a factor outside of our control. It is defined by the height of the horizontal scroll bar, which in turn will depend on the desktop theme and mode that user has selected.
-As a result, we will need to arrange the icons in the toolbar as we align it to the main window. This isn’t a problem: we’ve already seen how to move icons around using
As a result, we will need to arrange the icons in the toolbox as we align it to the main window. This isn’t a problem: we’ve already seen how to move icons around using
The first thing that we will do is to add four icons to the “Embedded” window template. Since we will be adjusting their size and position when the window is opened, it doesn’t matter where they go in the template: for ease of editing, we’ve done it as seen in
Given that space is limited, we will lay the toolbox out with the minimum of wasted real estate as shown in
As before, we start by reading the vertical size of a pixel in OS Units, and use that to calculate the height of both the visible area and work area of the toolbox – the value, also in OS Units, is stored in the
box_width% = toolbox%!88 * (icon_width% + pixel_width%) + pixel_width%
-Armed with all of these dimensions, we can lay the toolbar’s visble area out as before. Once that is done, we must step through each icon in turn and update its pisition using
Armed with all of these dimensions, we can lay the visble area of the toolbox out as before. Once that is done, we must step through each icon in turn and update its pisition using
FOR icon% = 0 TO toolbox%!88 - 1
xpos% = toolbox%!44 + icon% * (icon_width% + pixel_width%) + pixel_width%
@@ -297,11 +297,18 @@ NEXT icon%
One of the things that is worth noting here is the very limited – not to mention variable – space available for the icons in the toolbar. Care needs to be taken when designing the contents, to ensure that it can handle different screen modes and sizes of scroll bar whilst remaining clear and intuitive to the user. This is a problem that is getting worse as screen sizes reduce, and it may be that in a modern application, such toolbars are best limited to the kinds of uses seen in Paint (
One of the things that is worth noting here is the very limited – not to mention variable – space available for the icons in the toolbox. Care needs to be taken when designing the contents, to ensure that it can handle different screen modes and sizes of scroll bar whilst remaining clear and intuitive to the user. This is a problem that is getting worse as screen sizes reduce, and it may be that in a modern application, embedded toolboxes are best limited to the kinds of uses seen in Paint (
The full application with the code to position the icons can be found in
Although our new toolbox +