Re: action in TButton

Chytracek Radovan (chytrace@ns.saske.sk)
Thu, 30 Apr 1998 08:51:49 +0200 (MET DST)


On Wed, 29 Apr 1998, Judith Katzy wrote:

> Dear rooties,
>
> I have a macro tbut.C that I want to execute as a TButton action, but I
> get error messages. The macro is:
>
> #include <stdio.h>
> int tbut(Int_t ilayer)
> {
> printf("ilayer= %d\n",ilayer);
> return 0;
> }
>
> The DialogCanvas with button is:
>
> {
> TDialogCanvas *dialog = new TDialogCanvas("dialog","",700,780);
> TButton *but = new TButton("test",".x tbut.C(0)",.05,.8,.95,.88);
> but->Draw();
> }
>
> When I click on the test button I get the error message:
>
> Error: file tbut.C(0) can not open
>
> But I can execute the macro on the commandline via
> ROOT> .x tbut.C(0)
>
> What's going wrong? I thought I could do it (according to ROOT talk
> July 17, 1997).
>
> thanks for any help
> Judith
>
>
>
Hello,

try to rewrite your macros in one file tdgtest.C as:

------------- tdgtest.C -------------------
#include <stdio.h>

int tbut(Int_t ilayer)
{
printf("ilayer= %d\n",ilayer);
return 0;
}

void tdgtest()
{
TDialogCanvas *dialog = new TDialogCanvas("dialog","",700,780);
TButton *but = new TButton("test","tbut(0);",.05,.8,.95,.88);
but->Draw();
}
------------- cut here -------------------

Happy ROOTing

Radovan

#=============================================================#
# Radovan Chytracek Slovak Academy of Sciences #
# Watsonova 47,Kosice,04001, #
# Slovak Republic #
# phone: +42 95 633 2741-2 , ext. 156 fax : +42 95 633 6292 #
#===================#=========================================#
# Linux iii is the # chytrace@saske.sk #
# best (0 0) choice # http://www.saske.sk/~chytrace #
#===ooO==U==Ooo=====#=========================================#