> Hi rooters
> I have a class deriving from a TCanvas. I have rewritten the member
> function ExecuteEvent(Int_t event, Int_t px, Int_t py) and I want to
> obtain some information about mouse and keyboard.
>
> I have seen that event=1 if the left button is pressed and event=11 if
> it is released.
>
> -But how obtain a code for the middle button and right button?
> -When a key of the keyboard is pressed, event=24 but how to know which
> key is pressed?
>
See Button.h file:
#ifndef ROOT_Buttons
#define ROOT_Buttons
enum EEventType {
kNoEvent = 0,
kButton1Down = 1, kButton2Down = 2, kButton3Down = 3, kKeyDown = 4,
kButton1Up = 11, kButton2Up = 12, kButton3Up = 13, kKeyUp = 14,
kButton1Motion = 21, kButton2Motion = 22, kButton3Motion = 23, kKeyPress = 24,
kButton1Locate = 41, kButton2Locate = 42, kButton3Locate = 43,
kMouseMotion = 51, kMouseEnter = 52, kMouseLeave = 53,
kButton1Double = 61, kButton2Double = 62, kButton3Double = 63
};
enum EEditMode {
kPolyLine = 1, kSPolyLine = 2, kPolyGone = 3,
kSPolyGone = 4, kBox = 5, kDelete = 6,
kPad = 7, kText = 8, kEditor = 9,
kExit = 10, kPave = 11, kPaveLabel = 12,
kPaveText = 13, kPavesText = 14, kEllipse = 15,
kArc = 16, kLine = 17, kArrow = 18,
kGraph = 19, kMarker = 20, kPolyMarker= 21,
kPolyLine3D= 22, kWbox = 23, kGaxis = 24,
kF1 = 25, kF2 = 26, kF3 = 27,
kDiamond = 28, kPolyMarker3D = 29
};
#endif
See
http://root.cern.ch/root/html/src/TCanvas.cxx.html#TCanvas:DrawEventStatus
You can see if event == kKeyPress then "px" is the code of the key pressed.
("px/py" used to be passing the mouse coordinates for the mouse events)
Hope this helps,
Valery
> Thanks for your answers,
> Olivier Meplan
>
>
>
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:26 MET