PWquery: ASKING AN OBJECT WHAT IT CAN DO

This Chapter explains how to ask an object something about itself.

Purpose

The purpose of this keyword is to bring an object to tell something about itself. For example, if you have an object of the menu type, then you can ask it what the first item in the menu is. Thus, the query is a legal way to ask an object to deliver some information about itself which you couldn't get any other way.

Remember that in an object oriented system, there is (or at least should be) no way that you can know something about an object unless the object itself has some method to tell you this. What exactly this information is, depends on the object (and thus on the type of the object). This is mentioned in the description of the Types and Tags: where there is a description of a query tag for any type, you will find the explanation of what this tag does.

The manual always distinguishes between query tags, and change (& creation) tags, so there shouldn't be any possible confusion about when to use them.

Syntax

result= PWquery(object,what_tag)

A few exceptions

For three well-determined queries, PWquery does not return a number as a result, but a string. In these cases you must write "result$ = PWquery(...)" since the string will be returned directly.

The three exceptions are:

Example

box_left_object= PWquery (outline,PW('OUTLINE_BOX_LEFT'))

This returns the object which makes up the box to the left of a title within an outline. You can then change this object with PWchange.

l_item_t=PWquery(my_loose_item_object,PW('LOOSE_TEXT',))

item_text$=MKSTRING$(l_item_t)

This queries the item and gets a pointer to the text of the item from it, and then makes a string out of this, which is returned in item_text$.


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