How to know which button has been Clicked()

Dear rooters …

When a button is Clicked i wish to call a function taking the widget id as an argument

i had define my GUI in a class and on the click i wish to call a member of the GUI class ( All working in compiled mode )
I Tried with

button1->SetCommand(“this->sendparams($PARM1)”);
and
button1->SetCommand(“OnlineWindow::sendparams($PARM1)”);

but none worked
Is there a way to set a command using the button id as an argument and Specifying the class instance i wish to use ( as in Connect )

Thank you

Hi,

The button’s id(s) could be recognized following way in your slot method: TGButton *btn = (TGButton *) gTQSender; id = btn->WidgetId();
This way is used in the $ROOTSYS/tutorials/guitest.C macro. Please see the constructor of TestDialog class and its method TestDialog::HandleButtons for more details. It is important to specify the widget’s ids in their constructors for later use in the application.

Cheers, Ilka

It work …
Thank you :smiley: