File: mouse5.pp

package info (click to toggle)
fpc 2.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 179,708 kB
  • ctags: 311,888
  • sloc: pascal: 1,780,013; makefile: 856,684; xml: 126,079; ansic: 9,172; perl: 7,711; asm: 7,655; yacc: 3,721; lex: 2,539; sh: 2,032; php: 451; sql: 246; sed: 132; cpp: 79; csh: 34; tcl: 7
file content (73 lines) | stat: -rw-r--r-- 2,689 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{example for GetLastButtonPress and GetLastButtonRelease}

Uses MsMouse, Crt;

Var x, y, times: Longint;
    c: Char;

Begin
  If MouseFound Then
    Begin
      ClrScr;
      ShowMouse;
      Writeln('Move the mouse and click the buttons (press escape to quit).');
      Writeln('Press the L-key to see the stats for the left button.');
      Writeln('Press the R-key to see the stats for the right button.');
      Writeln('Press the M-key to see the stats for the middle button.');
      GotoXY(1,19);
      Write('Since the last call to GetLastButtonPress with this button as parameter, the');
      GotoXY(1,22);
      Write('Since the last call to GetLastButtonRelease with this button as parameter, the');
      Repeat
        If Keypressed Then
          Begin
            c := UpCase(Readkey);
            Case c Of
              'L':
                Begin
                  GotoXY(1, 20);
                  ClrEol;
                  times := GetLastButtonPress(LButton, x, y);
                  Write('left button has been pressed ',times,
                          ' times, the last time at (',x,',',y,')');
                  times := GetLastButtonRelease(LButton, x, y);
                  GotoXY(1,23);
                  ClrEol;
                  Write('left button has been released ',times,
                          ' times, the last time at (',x,',',y,')')
                End;
              'R':
                Begin
                  GotoXY(1, 20);
                  ClrEol;
                  times := GetLastButtonPress(RButton, x, y);
                  Writeln('right button has been pressed ',times,
                          ' times, the last time at (',x,',',y,')');
                  times := GetLastButtonRelease(RButton, x, y);
                  GotoXY(1,23);
                  ClrEol;
                  Write('right button has been released ',times,
                          ' times, the last time at (',x,',',y,')')
                End;
              'M':
                Begin
                  GotoXY(1, 20);
                  ClrEol;
                  times := GetLastButtonPress(MButton, x, y);
                  Writeln('middle button has been pressed ',times,
                          ' times, the last time at (',x,',',y,')');
                  times := GetLastButtonRelease(MButton, x, y);
                  GotoXY(1,23);
                  ClrEol;
                  Write('middle button has been released ',times,
                          ' times, the last time at (',x,',',y,')')
                End
            End
          End;
      Until (c = #27); {escape}
      While KeyPressed do ReadKey;
      GotoXY(1,24);
      HideMouse
    End
End.