PW: GETTING THE TAGS

This Chapter explains how you get the value of the tags in SBasic.

Purpose

As you will have noticed in the description concerning the PWcreate keyword, you have to give this keyword some types and some tags. This is also true for the PWchange and PWquery keywords. Now, types and tags are actually numerical values, i.e. TYPE_OUTLINE is equal to $4F55544C and POSITION_BELOW is equal to $11000004. In other words, they are variables.

You can, of course, use the direct values in the functions instead of the variables, but then you would have to know the value of each variable. Instead, you will find that in all the examples and explanations, only the names of the variables are used.

Since there are over two hundred tags and a few types, this would mean that learning all the values by heart would be a bit difficult. This problem doesn't exist for 'C' or assembler programmers who can define 'include files' which contain all of these values and define them as "variables", since these variable later no longer exist.

One could, of course, simply have a procedure initialising all the variables, something like:

         DEFine PROCedure init_tags
                   TYPE_OUTLINE        = $4454544C
                   POSITION_BELOW      = $11000004
         (...)
         END DEFine init_tags

Since there are 218 definitions like that, each program in ProWesS would already be at least 218 lines long (or, if you number in increments of ten, lines 10 to 2190 would already be taken...) without you having done anything! This would lead to an inflation in program size, and every SBasic program in ProWesS would have to include this, making the inflation even larger still!

This is why the PW keyword exists. It is a function which takes as parameter the name of a type/tag and returns the value for it.

Syntax

PW is a function, used as follows:

result=PW(tag$)

Tag$ is the tag or type to get. It would be best if this were within quotes. It is possible to leave it without quotes since the keyword should be intelligent enough to figure this out. However,leaving it without quotes might give rise to problems when compiling your program later on.

The names for the tags (and types) can be found in the part of the manual containing a detailed description of them. If you have a look there, you will notice that they all start with 'PW', and have the format PW(name) - e.g. PW('TYPE_OUTLINE'). The 'C' manual uses the entire name, including the 'PW_'. In the PW function, you only type the name part.

It doesn't matter whether you write the actual name in upper or lower case. However, since in the manual they are all described in upper case, this was used throughout this SBasic manual, and in all of the examples.

Example

In the manual, you might find the name PW('OUTLINE_QUIT_ACTION') for a certain tag. In SBasic, you would thus write:

object=PWcreate(....,PW('OUTLINE_QUIT_ACTION')...).


PROGS, Professional & Graphical Software
last edited 1996 May 29 (wl)