Chapter 8 Keyboard and Mouse Events Windows Programming
Chapter 8 Keyboard and Mouse Events Windows Programming, C. -S. Shieh, KUAS EC, 2005 1
8. 2 On. Key. Press Event • On. Key. Press(TObject *Sender, char &Key) – if(Key==13)…; Windows Programming, C. -S. Shieh, KUAS EC, 2005 2
8. 3 On. Key. Down and On. Key. Up Events • On. Key. Down(System: : TObject* Sender, Word &Key, Classes: : TShift. State Shift) • On. Key. Up(System: : TObject* Sender, Word &Key, Classes: : TShift. State Shift) • Virtual key codes – if(Key==VK_F 1)…; • TShift. State – if(Shift. Contains(ss. Ctrl))…; – if(Shift. Contains(ss. Shift))…; – if(Shift. Contains(ss. Alt))…; Windows Programming, C. -S. Shieh, KUAS EC, 2005 3
8. 4 On. Click and On. Dbl. Click Events • On. Click • On. Dbl. Click Windows Programming, C. -S. Shieh, KUAS EC, 2005 4
8. 7 On. Mouse. Down, On. Mouse. Up, and On. Mouse. Move Events • On. Mouse. Down(TObject *Sender, TMouse. Button, TShift. State Shift, int X, int Y) • On. Mouse. Up(TObject *Sender, TMouse. Button, TShift. State Shift, int X, int Y) – if(Button==mb. Left)…; • On. Mouse. Move(TObject *Sender, TShift. State Shift, int X, int Y) Windows Programming, C. -S. Shieh, KUAS EC, 2005 5
8. 8 Drag and Drop • Properties – Drag. Mode, Drag. Cursor • Events – On. Drag. Over(System: : TObject* Sender, System: : TObject * Source, int X, int Y, TDrag. State, bool &Accept) – On. Drag. Drop(System: : TObject* Sender, System: : TObject * Source, int X, int Y) Windows Programming, C. -S. Shieh, KUAS EC, 2005 6
- Slides: 6