Back to Contents Previous Next
29. Indirection
Throughout this manual, you will have seen many references to ‘indirected icons’ or ‘indirected text’. Here is a brief description of what it means, and why it is important to using the Wimp. (Dr Wimp actually removes all the complications of handling indirected or non-indirected features, but it is nonetheless better to have an appreciation of this topic.)
Each icon in the desktop is defined by a small block of memory. This block is of a fixed size (plus any indirected items - see below) and contains a complete description of the icon so that the Wimp can draw it.
This block contains the dimensions, several flags containing information such as whether it is a sprite, text, sprite and text, filled, has a border, etc and some data on what it contains, such as actual sprite name or text. Most of the flags you can toggle between set and unset using a template editor, such as !WinEd.
The total size of the icon block is 32 bytes. 12 of these are used for holding the data concerning the text and/or sprite used in the icon. You can specify a text-only icon, a sprite-only icon or a text-plus-sprite icon. You can also specify whether the text or icon name is to be ‘indirected’ or ‘non-indirected’.
If you choose ‘non-indirected’ it means that the text (or icon name) is held in the icon’s data block directly - and thus cannot be changed and is subject to a rather small maximum size (11 characters plus a terminator).
If you choose ‘indirected’ it means that the icon’s data block holds the value of the maximum allowable length of the text and a pointer (memory location) to where the text is stored. Thus the text in the icon can easily be changed by changing the text in the memory location where it is stored and it is not subject to the 11+1 character limit. This is what happens when you use PROCwimp_puticontext
, which we saw in Section 2.3. An indirected icon can also have a validation string - see Section2.28
Therefore, ‘indirection’ - which is a general concept - essentially means that the text (or sprite name, or other data) is held somewhere else which is located by its memory pointer. Indirection can apply to many other circumstances e.g. window titles, menu title/text.
If you use an indirected text-plus-sprite icon, the text is indirected as just described but the indirected sprite name is then held in the validation string - under the S-command (see earlier) - which itself is indirected memory space.
Once you have decided whether or not to use indirection in icons and window titles when preparing your window templates, Dr Wimp removes all the complications of handling the consequences of the choice.
By the way, if you define an icon as indirected with an indirected size of, say, 16 and then use PROCwimp_puticontext
to try to put in a string greater than 15 characters long (15 plus terminator equals 16), the text of the new string will be truncated automatically to the defined maximum i.e. 15 characters, here.
Top of page Back to Contents Previous Next