Recongnize the control sending the signal

Hello,

For a long time I am struggling with the following. I connect a signal to controls, for example to TGNumberEntry and TGTextButton. For sake of simplicity I’d like to connect both controls to a single method. The problem is, that then inside the method I should decide if I want to use:

		wdg = ROOT.BindObject(ROOT.gTQSender, ROOT.TGTextButton)

or

		wdg = ROOT.BindObject(ROOT.gTQSender, ROOT.TGNumberEntry)

Is there any way to tell to which class I should bind the object?

OK, I answer me myself:

		wdg = ROOT.BindObject(ROOT.gTQSender, ROOT.TObject)

		if wdg.InheritsFrom("TGNumberEntry"):
			wdg = ROOT.BindObject(ROOT.gTQSender, ROOT.TGNumberEntry)
		elif wdg.InheritsFrom("TGTextButton"):
			wdg = ROOT.BindObject(ROOT.gTQSender, ROOT.TGTextButton)

Of course, it would be nicer if the object got somehow automatically bind to a proper class, but I am not sure if that is possible.