next up previous contents index
Next: The new_item Tags Up: Interactive Elements Previous: Creating Items

The new_item Function

 

Creating items and setting their attributes can get quite complex, especially when groups or layers are involved. Of course you have to remember the order of parameters for the "new-instance" methods and which methods have to be called first -- for example you have to call "set-offset" after setting minimum, maximum and scale, otherwise the result is undefined. To simplify creating complex items we have created an interface which takes care of the mentioned problems and does an extended error checking. It consists of a single function with a variable parameter list:

ITEM *new_item(CLASS *, ...);
The first parameter is the class of the item which should be created, then the item description follows. If the item can be created it is returned. With this function the sequence of GRAPE calls above for creating the ruler can be replaced by the single call
ruler = (RULER *)new_item(Ruler, I_Name, "var", I_Var, &var, dfDouble,
                          I_MinMax, 0.0, 1.0, I_Scale, 1.0, I_Offset, 0.0, I_End);
The item description consists of so called ``tags'' (all starting with I_) and their parameters. It always has to be terminated by I_End, otherwise you will get errors and the item will not be created.

The new_item function is currently under developement therefore some classes like checkfields and function-rulers are still missing. An example on how this function can be used is given in section 5.6.6.1.





SFB 256 Universität Bonn and IAM Universität Freiburg

Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.