On 2 Oct 97 at 1:09, Pasha Murat wrote: > > Hello ROOT developers, > > is it intentional that TCanvas::HandleInput doesn't have a default > for an X/Win event? Right now if an event is different from a small > number of events generated by mouse (press-left-button, move mouse, > release-left-button etc) TCanvas::HandleInput just returns. For > example it is not possible to process a keyboard hit... The reason for that is Pick() method. Very this method defines what kind of the object the Mouse Cursor "is pointing" (via DistanceToPrimitive() method of TObject()). To use other events some sort of the way to link that event with ROOT object must be offered. For example TGLViewerImp (see below). What is special with this example. The point is that TGLViewerImp is a special "Canvas" object and it can contain only ONE type of the objects, namely TPadOpenGLView.(When the normal TCanvas may contain ANY type of the objects). So for this object it is out question which ExecuteEvent() should be called. //______________________________________ void TGLViewerImp::HandleInput(EEventType button, Int_t x, Int_t y) { if (!fGLView) return; switch (button) { case kButton1Down: case kButton1Up: case kButton1Motion: case kKeyPress : fGLView->ExecuteEvent(button,x,y); break; default: break; } } Where TPadOpenGLView *fGLView; // Pointer to Pad GL View object; and //____________________________________________________________________________ void TPadOpenGLView::ExecuteEvent(EEventType event, Int_t px, Int_t py) { switch ((EEventType)event) { case kButton1Down: //*-* Save the start coordinates fMouseInit=kTRUE; fMouseX = px; fMouseY = py; break; case kKeyPress : { Char_t chCharCode = (Char_t) px; // if (chCharCode != '+' || chCharCode != '-') chCharCode |= 0x20; MoveModelView(chCharCode, py); break; } case kButton1Up: if (!fMouseInit) break; fMouseInit=kFALSE; RotateView(px,py); fMouseX = px; fMouseY = py; PaintScene(); break; case kButton1Motion: if (!fMouseInit) break; RotateView(px,py); fMouseX = px; fMouseY = py; PaintScene(); break; default: break; }; } > > I'd expect a lot of (potential) users would like to use this > feature. Yes, but for that probably we need first to be able to "Select" some object with the very mouse event (actually it should a separate method called by the mouse events) and THEN apply another events. (See TObjectView class descrition as example too) Regards, Valery Dr. Valeri Faine (Valery Fine) ------------ ------------- Phone: +41 22 767 4921 CERN FAX : +41 22 767 7155 CH-1211 Geneva, 23 mailto:fine@mail.cern.ch Switzerland http://nicewww.cern.ch/~fine
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:21 MET