IF USING NOTEPAD THEN PLEASE TURN ON WORDWRAP

TagInterpreter Version 1	Bob Tarling (c) 2000

The TagInterpreter allows a programmer to set the properties of an instance of a visual control by using the painter (window painter or custom object painter). Instead of writing code in the constructor event for each instance of an object to set it's inital values the initials values can be placed in the tag and the code to interpret these values has to be written once only.

Powerbuilder 7 introduced a new feature in painters that allow instance variables to given values in the painter rather than by setting code. This is an improvement on previous versions but forces the programmer into making those instance variables public.

TagInterpreter allows a user object to interpret various properties set within its own tag field.

As many variables as required can be given in the tag, each seperated by a comma. The first variable should always be called tag, this will replace the tag value after interpretation.

Variables can be added to the tag simply in order to act as a flag or can be given a value by using an equals sign.

For example a tag of -

	tag="Micorhelp text",checked,label="Enter name"

Will create a tag variable called "checked" with no value and a tag variable called "label" with the value "Enter name". Once these variables have been created the tag will be replaced with the text "Microhelp text".

If you wish to create a tag variable containing quote characters then you can use apostophe's instead of quotes.

For Example -

	tag="Microhelp text",quotelabel='John said "Hello"'

If you wish to create a tag variable containing both quote characters and apostrophes then you will need to concatenate strings with a plus symbol.

	tag="Microhelp text",quotelabel='John said "Hello" '+"to the girl's"

The TagInterpreter will fail to interpret anything that fails to keep strictly to the standards above. If it fails then the tag will be left unchanged and zero tag variables will be returned. Do not use white space outside of quotes.

There are three public functions to this object.

int of_scan(reference string as_tag)
	Scans a tag string argument to strip out variables.
	Converts the tag the value in the first "tag" variable.
	Returns the number of tag variables found.

string of_getLabel(ai_variableNo)
	Returns the variable name of the variable at posn ai_variableNo

string of_getValue(ai_variableNo)
	Returns the variable value of the variable at posn ai_variableNo

See the example object and window for further clarification.

Although supplied as a non visual object for demonstration purposes I actually tend to copy the code into the base classes of my visual objects. This is quite simply to avoid the need for repeatedly creating and destroying an object every time there is a tag to interpret (used quite extensively now in my own applications). The object could be created in gnv_app but this would tie the user to a framework.


Freeware
========
This code is free to use and may be distributed providing no modifications are made. If you wish to report a bug, submit or request modifications or even just let me know what you think of my components then email bob@raspberry.demon.co.uk


Thanks
======
Thanks to Ken Howe for distributing this for me. Visit http://www.pbdr.com


Change History
==============
Version 1: Initial release
