next up previous contents index
Next: CheckField Up: Classes and Methods Previous: Bar1d

Button

  (subclass of 9.1.3.14 Interactive)

A button is a simple object, which will send its action method to itself if you click on it. You can change this action method using the method "set-action" (see 9.1.3.14). Normally this will be the "default-action" (9.1.3.14), which will send the method you can choose with "set-method" (9.1.3.14) to the instance you set using "set-instance" (9.1.3.14). Also the "default-action" will switch the button again. If you only set the method a button sends, and you set no instance, the button will send the method to the current object of the manager (see section 4.3.2). You can set the instance and method also in the "new-instance" method of a button. If you don't know the instance or method at that time, or you want to set a different action method, you can give a NULL parameter as the method and/or as the instance.

   GRAPE(button, "default-action")()
BUTTON *button
The default action of a Button. Sends the Button's method to the according instance. If instance is NULL, the method is sent to the current object of the manager.

   GRAPE(Button, "new-instance")(meth, inst, name)
CLASS *Button
char *meth
INSTANCE *inst
char *name
Creates and returns a new Button instance named name. When pressed a Button calls its action, the preset action "default-action" will send the method meth to the instance inst; for other purposes another action can be set using ""set-action".

   GRAPE(button, "pop-items-layer")()
BUTTON *button
Action to be set if the Button is used to show the layer its instance resides in. If the layer is already added to the manager, it is simply brougth into front, else it is added to the manager.

   GRAPE(button, "pop-layer-action")()
BUTTON *button
Action to be set if the Button is used to create a Layer. When the Button is pressed, it checks if the Layer already exists. If that is true, the Layer is made visible and popped to be the upper one. Else the method is called on the instance, which has to create the Layer and to insert it into the layer-list of the Button using "layer-list-add"; to make this easy the Button is passed as argument of the method.

   GRAPE(button, "set-state")(on_off)
BUTTON *button
int on_off
If on_off == ON, the Button is drawn pressed, if on_off == OFF it is unpressed.

   GRAPE(button, "switch-state")()
BUTTON *button
Toggle the pressed state of a button.


next up previous contents index
Next: CheckField Up: Classes and Methods Previous: Bar1d

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.