#include "ginteractors.h"

class GButton : public GInteractor

This interactor subclass represents an onscreen button. The following program displays a button that, when pressed, generates the message “Please do not press this button again” (with thanks to Douglas Adams’s Hitchhiker’s Guide to the Galaxy):
   int main() {
      GWindow gw;
      GButton *button = new GButton("RED");
      gw.addToRegion(button, "SOUTH");
      while (true) {
         GEvent e = waitForEvent(ACTION_EVENT | CLICK_EVENT);
         if (e.getEventType() == MOUSE_CLICKED) break;
         cout << "Please do not press this button again." << endl;
      }
      return 0;
   }
Constructor
GButton(label) Creates a GButton with the specified label.

Constructor detail


GButton(string label);
Creates a GButton with the specified label. This constructor also sets the action command for the button to the label string.

Usage:

GButton *button = new GButton(label);