The KeyPressed signal


I am trying to make use of the KeyPressed signal via a ACLIC dispatcher. The problem is, that it seems that on the Python side it looses the 4th parameter. Inside the dispatcher I have:

	PyObject* Dispatch( TGFrame* o1, UInt_t k, UInt_t m)
		cout << o1 << " " << k << " " << m << endl;
		return DispatchVA( "li", o1, k, m);

which properly displays both the key “k” and the mask “m”. On python side:

	def handle_list_key(self, frame, key, m):
		entry = ROOT.BindObject(frame, "TGLVEntry")
		# If dbl click was made with left mouse button
		print entry.GetItemName(), key, mask

	def _init_(.....):
		self.list_dispatch_key = ROOT.EtosDispatcher(self.handle_list_key)
		self.eventlist_container.Connect("KeyPressed(TGFrame*, UInt_t, UInt_t)", "EtosDispatcher", self.list_dispatch_key, "Dispatch(TGFrame*, UInt_t, UInt_t)")

this way it doesn’t work:

If I remove the “m” parameter from handle_list_key definition, it works, however I don’t get mask, of course. I guess TPyDispatcher from which my dispatcher inherits works only up to 2 parameters?


the call in TPyDispatcher looks fine: PyObject* Dispatch( TGFrame* frame, UInt_t keysym, UInt_t mask ) { return DispatchVA1( "TGFrame", frame, "II", keysym, mask ); }
Is the code that you post in EtosDispatcher masking the above? If yes, the “li” states that there are only two parameters, a long an in int, passed. That would explain.


Ahh, and I was wondering what “li” stands for. Thanks!


possible argument strings are defined in the python docs. In this case, you’d want “lII” (lower case l and 2x capital ‘i’; i.e. long/pointer val and two unsigned int values). Or rather, do what TPyDispatcher does by passing the frame pointer as an object.


Thanks, did it just specifying “lii” for now. Works.