GUI: pass number entry AND label?

I am a ROOT newcomer. I am building a GUI application with numerical entries. Since I get more than 40 input fields, I have created a map<string, int> in order to iterate. That works: it creates the widgets I need, and I am able to pass the numerical value of the TGNumberEntry to a trivial “echo” void “PrintOut” via
val=num_widget->GetNumberEntry()->Connect(“TextChanged(char*)”, “myclass”,gApplication, “PrintOut(char*)”);

It gets nicely the updated numerical value, but I do not know hot to tell “PrintOut” what TGLabel it was related to. My first idea was to add a string or char argument to “PrintOut”. It did not work.

But maybe there’s a more clever and compact way to deal with a great number of identical (integer) entries? All I want is to pass all the updated entries to another part of the program, without defining all fields one by one. Maybe having
helps? I cannot take advantage of it. I have checked several GUI tutorials but did not find anything in the direction I am looking for.



I’m not sure to really understand what you’re trying to do, but you could try to give a name to each TGNumberEntry, and then retrieve it via the sender of the signal. Something like this:


void YourClass::PrintOut(char*)
   TGNumberEntry *entry = (TGNumberEntry*)gTQSender;
   cout << "signal coming from " << entry->GetName() << endl;

And if this doesn’t help, feel free to send a running piece of code showing what you’re trying to achieve.

Cheer, Bertrand.

Cheers, Bertrand.

You DID solve my problem! Thanks a lot.


You’re welcome :slight_smile:

Cheers, Bertrand