ex3.pp 894 B

12345678910111213141516171819202122232425262728293031323334353637
  1. Program Example3;
  2. { Program to demonstrate the GetMouseEvent function. }
  3. Uses mouse;
  4. Var
  5. Event : TMouseEvent;
  6. begin
  7. InitMouse;
  8. Writeln('Play with mouse. Press right mouse button to end.');
  9. Repeat
  10. GetMouseEvent(Event);
  11. With event do
  12. begin
  13. Write('Action:');
  14. Case Action of
  15. MouseActionDown : Write('Mouse down.');
  16. MouseActionUp : Write('Mouse up.');
  17. MouseActionMove : Write('Mouse move.');
  18. end;
  19. Writeln('Button state : ');
  20. If (Buttons and MouseLeftbutton)<>0 then
  21. Write('Left ');
  22. If (Buttons and MouseRightbutton)<>0 then
  23. Write('Right ');
  24. If (Buttons and MouseMiddlebutton)<>0 then
  25. Write('Middle ');
  26. Write('Button(s)');
  27. Writeln(' at ',X,',',Y,'.');
  28. end;
  29. Until (Event.Buttons=MouseRightButton) and
  30. (Event.Action=MouseActionDown);
  31. DoneMouse;
  32. end.