TButton

From: Grave Xavier (xavier@lapp.in2p3.fr)
Date: Thu May 15 1997 - 16:16:30 MEST


Hello,

I'm trying to use the TButton Class to make a data display.
Can somebody send me a simple example :
a canvas + a button.
when you click the button you get "toto" in the standard outpout.

I've tryed this :

#include "TROOT.h"
#include "TApplication.h"
#include "TCanvas.h"
#include "TButton.h"
#include <iostream.h>

extern void InitGui();
VoidFuncPtr_t initfuncs[] = { InitGui, 0 };
int Error;  // needed by Motif

TROOT root("hello","Hello World", initfuncs);

void toto(void);

int main(int argc, char **argv)
{TCanvas *menu;
 TApplication *theApp;
 TButton *bouton1;

 theApp = new TApplication("App", &argc, argv);

 menu = new TCanvas("Hello", "The Hello Canvas",400,600);
 menu->SetFillColor(10);
 menu->Show();

 bouton1 = new TButton("FUNCTION","Input
File","toto()",0.2,0.2,0.8,0.4);
 bouton1->Draw();

 menu->Update();

 theApp->Run();

 return 0;
}

void toto(void)
{
  cout << "toto\n";
}

If some body have something I will be greatfull.

Xavier Grave

PS : I'm a cxx user on DecStation

-- 
xavier@virgoa4.in2p3.fr



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:18 MET